define(['./custom/widgets/js/yufpSelectParam.js','./index.css','./plTableStyle.css'], function(require, exports) {
	/**
	 * 页面加载完成时触发
	 * @param hashCode 路由ID
	 * @param data 传递数据对象
	 * @param cite 页面站点信息
	 */
	exports.ready = function(hashCode, data, cite) {
		yufp.lookup.reg('USE_EVENT_TYPE');
		yufp.lookup.reg('USE_EVT_REL_TYPE');	
		yufp.lookup.reg('USE_TASK_JOB_TYPE');
		var thisRow = '0';
		var thisval = '';
		var opval ='';
		var taskft = {};
		yufp.custom.vue({
			el: cite.el,
			data: function() {
				var _this = this;
/* 				var eventTypeOption = [{
						key: 'G',
						value: '普通事件'
					},
					{
						key: 'F',
						value: '文件事件'
					}
				] */

				var check = function(rule, value, callback) {
					if (value === null || value === undefined || value === '') {
						callback(new Error('字段不能为空'));
					} else {
						callback();
					}
				};
				var limit = function(rule, value, callback) {
					if (value === null || value === undefined || value === '') {
						callback();
					} else {
						if (value.length !== 6 || !/^[0-9]+$/.test(value)) {
							callback(new Error('请输入六位时间格式'));
						} else {
							if (value.slice(0, 1) != 0 ? value.slice(0, 2) > 24 : false) {
								callback(new Error('小时数必须小于或等于24'));
							} else if (value.slice(2, 3) != 0 ? value.slice(2, 4) >= 60 : false) {
								callback(new Error('分钟数必须小于60'));
							} else if (value.slice(4, 5) != 0 ? value.slice(4) >= 60 : false) {
								callback(new Error('秒数必须小于60'));
							} else {
								callback();
							}
						}
					}
				};
				/*定义校验规则，只能填字母数字 下划线*/
				var valiCodes = function(rule, value, callback) {
					var reg = /^[0-9.a-z-A-Z_]{1,}$/;
					if (value && reg.test(value)) {
						if (value.length > 32) {
							callback(new Error('长度不能大于32位'));
						} else {
							callback();
						}
					} else if (value && !reg.test(value)) {
						callback(new Error('能填字母、数字、下划线、点号和横线'));
					} else {
						callback();
					}
				};
				/*定义校验规则，只能填字母数字 下划线 . - _*/
				var valiCodesGo = function(rule, value, callback) {
					var reg = /^[0-9a-zA-Z_]{1,}$/;
					if (value && reg.test(value)) {
						if (value.length > 64) {
							callback(new Error('长度不能大于64位'));
						} else {
							callback();
						}
					} else if (value && !reg.test(value)) {
						callback(new Error('能填字母、数字和下划线'));
					} else {
						callback();
					}
				};
				/**检验数字为0-255*/
				var numMax = function(rule, value, callback) {
					if (value) {
						if (Number(value) >= 0 && Number(value) <= 255) {
							callback();
						} else {
							callback(new Error('必须为0-255之间'));
						}
					} else {
						callback();
					}
				};
				/*定义只能输入8位有效时间*/
				var valiDateWeek = function(rule, value, callback) {
					var reg = /^(\d{4})(\d{2})(\d{2})$/; //yyyymmdd
					var reg1 = /\{\#.*?\#\}/g
					if (value && (reg.test(value) || reg1.test(value))) {
						callback();
					} else {
						callback(new Error('只能为yyyyMMdd格式或选择参数'));
					}
				};
				return {
					data2Sel:[],
					data3Sel:[],
					rowHeight:40,
					cover:'N',//导入标志
					versionRules:[
						{ required: true, message: '必填项', trigger: 'blur' },
						{ validator: valiCodes, trigger: 'blur' }	
					],
					importJoblist:[],
					loading2:false,
					loading3:false,
					relHeight:yufp.frame.size().height - 70 + 'px',
					relHeightT:yufp.frame.size().height - 120,
					height: yufp.frame.size().height - 114,
					treeHeight:'100%',
					tbHeight:'100%',
					reltitle:'源表依赖查看',
					jobCodeDetail:'',
					groupCodeDetail:'',
					relType:'',//查看依赖的依赖类型
					viewRelData:[],
					viewRelDialog:false,//查看依赖关系弹框
					JobShowData:[],/**当前依赖列表*/
					relJobShow:false,
					EventShowData:[],/**当前依赖列表*/
					reEventShow:false,
					showSrcTabDialog:false,
					srcTabData:[//源表列表
/* 						{'tabName':'aaaa','env':'','schema':'',isAdd:false,existFlag:'Y'},
						{'tabName':'bbbb','env':'','schema':'',isAdd:false,existFlag:'Y'}, */
					],
					relTypeList:[//作业依赖类型
						{'key':'SRCTAB','value':'源表依赖'},
						{'key':'GERERAL','value':'普通依赖'},
						{'key':'EVENT','value':'事件依赖'}
					],
					showSrcTarDialog:false,
					srcTarData:[//源表列表
					],
					chooseSrcDialogVisible: false,
					srcParamDataUrl: 'api/use/citiccard/jobconf/querySrcTabs',
					queryFormSrc: [{
						placeholder: '源表名称',
						field: 'tabName',
						type: 'input'
					},{
						placeholder: '源表环境',
						field: 'env',
						type: 'input'
					},{
						placeholder: '源表数据库',
						field: 'schema',
						type: 'input'
					}],
					srcFieldColumns: [{
							label: '源表名称',
							prop: 'resultTableName',
							resizable: true
						},
						{
							label: '源表环境',
							prop: 'env',
							resizable: true
						},
						{
							label: '源表数据库',
							prop: 'schema',
							resizable: true
						}
						
					],
					srcParamButtons: [{
							label: '搜索',
							op: 'submit',
							type: 'primary',
							click: function(model, valid) {
								if (valid) {					
									var param = {
										condition: JSON.stringify(model)
									};
									_this.$refs.srcTableRef.remoteData(param);
								}
							}
						},
						{
							label: '确定',
							op: 'submit',
							type: 'primary',
							click: function(model, valid) {
								 var sellist =  _this.$refs.srcTableRef.selections;
								 var addlist = [];
								 if(sellist && sellist.length > 0){
									 for(var item in sellist){	    
											var flag = false;
											for(var oj in _this.srcTabData){
												 if(sellist[item].env == _this.srcTabData[oj].env &&sellist[item].schema == _this.srcTabData[oj].schema && sellist[item].resultTableName == _this.srcTabData[oj].tabName){
													 flag = true;
												 }
											}
											if(!flag){
												addlist.push({'tabName':sellist[item].resultTableName,'env':sellist[item].env,'schema':sellist[item].schema,isAdd:false,existsFlag:''});
											}
									 }
									 _this.chooseSrcDialogVisible = false;
									 _this.$nextTick(function(){
										_this.srcTabData = _this.srcTabData.concat(addlist);
										 
									 })
								 }else{
									 _this.$message({
									 	message: '请至少选择一条记录！',
									 	type: 'warning'
									 });
									 return;
								 }
							}
						}
					],
					/*导入的参数定义*/
					activeJob: 'hadjob',
					hadJobData: [], //存量的作业流
					hadJobDataOld:[],//存量的作业流，用于过滤
					upLoadUrl: yufp.service.getUrl({
						url: "api/file/provider/uploadfile"
					}), //导入的url
					upLoadDialogVisible: false,
					backupDialogVisible:false,
					restoreDialogVisible:false,
					excelloading: false,
					appUploadDatas: [], //文件列表
					jobdisabled: false,
					flowdisabled: false,

					editflag: 'add', //默认为新增
					eventVisibleRef: false, //依赖事件的弹出框
					taskDialog: false, //作业流高级信息弹框
					activeTabName: "taskInfo",
					formDataTask: {
						taskType: 'T' //默认自能选择触发
					},
					paramDatas: [{
						paramCode: "a",
						paramName: "b",
						paramValue: "c",
						remark: "add"
					}],
					groupCodeOptions: [],
					updateFlag: false,
					triggerRules: [{
						required: true,
						message: '必填项',
						trigger: 'blur'
					}],
					isTrigger: false,
					weekrules: [{
							required: true,
							message: '必填项',
							trigger: 'blur'
						},
						{
							validator: valiDateWeek,
							trigger: 'blur'
						}
					],
					chooseCommonParamDialogVisible: false,
					calendarCodeOptions: [],
					// 触发器选择
		/* 			chooseTriggerDialogVisible: false, */
					showInsideCycleTime: false,
					// 展示内置时点选择标志
					InSideFlagOptions: [{
							key: 'Y',
							value: '是'
						},
						{
							key: 'N',
							value: '否'
						}
					],
					nodeTemp: {},
					rulesCode: [{
						validator: valiCodes,
						trigger: 'blur'
					}],
					triggerOptions: [],
					/*公共宏参数 和 任务触发器的弹框参数*/
	/* 				chooseCommonParamDialogVisible: false, */
					chooseTriggerDialogVisible: false,
					commParamDataUrl: 'api/use/plats/paramValue/queryMacrosList',
					commParamBase: {
						condition: {}
					},
					commParamFieldColumns: [{
							label: '参数名称',
							prop: 'paramName',
							resizable: true
						},
						{
							label: '参数代码',
							prop: 'paramCode',
							resizable: true
						}
					],
					commParamFieldDatas: [{
						placeholder: '参数名称',
						field: 'paramName',
						type: 'input'
					}],
					commParamButtons: [{
							label: '搜索',
							op: 'submit',
							type: 'primary',
							click: function(model, valid) {
								if (valid) {
									if (_this.addFlag) {
										model.appCode = _this.currentClickNode.appCode;
									} else {
										model.appCode = _this.$refs.refTable.selections[0].appCode;
									}

									var param = {
										condition: JSON.stringify(model)
									};
									_this.$refs.commParamTableRef.remoteData(param);
								}
							}
						},
						{
							label: '确定',
							op: 'submit',
							type: 'primary',
							click: function(model, valid) {
								_this.selectCommParamValue();
							}
						}
					],
					// 触发器url
					triggerDataUrl: 'api/use/plats/trigger/queryList',
					triggerParams:{
						condition: JSON.stringify({
							appCode:'',
						})
					},
					// 触发器选择-查询条件
					triggerFieldDatas: [{
						placeholder: '触发器名称',
						field: 'timerName',
						type: 'input'
					}],
					// 触发器选择-按钮
					triggerButtons: [{
							label: '搜索',
							op: 'submit',
							type: 'primary',
							click: function(model, valid) {
								if (valid) {
									if (_this.addFlag) {
										model.appCode = _this.currentClickNode.appCode;
									} else {
										model.appCode = _this.$refs.refTable.selections[0].appCode;
									}
									var param = {
										condition: JSON.stringify(model)
									};
									_this.$refs.triggerTableRef.remoteData(param);
								}
							}
						},
						{
							label: '确定',
							op: 'submit',
							type: 'primary',
							click: function(model, valid) {
								_this.selectTriggerValue();
							}
						},
						{
							label: '人工触发',
							op: 'submit',
							click: function(model, valid) {
								_this.data2flex[_this.editDowIndexflex].formDataTask.triggerNm = '人工触发';
								_this.data2flex[_this.editDowIndexflex].formDataTask.triggerId = '-'
								_this.chooseTriggerDialogVisible = false;
							}
						}
					],
					// 触发器选择-列表字段
					triggerFieldColumns: [{
							label: '触发器编号',
							prop: 'timerCode',
							resizable: true
						},
						{
							label: '触发器名称',
							prop: 'timerName',
							resizable: true
						},
						{
							label: '开始日期',
							prop: 'effectDate',
							resizable: true
						},
						{
							label: '结束日期',
							prop: 'expireDate',
							resizable: true
						},
						{
							label: '表达式',
							prop: 'expression',
							resizable: true
						},
						{
							label: '备注',
							prop: 'remark',
							resizable: true
						}
					],
					queryRefDataList: "api/use/plats/taskSchedule/queryRefDataList",



					dialogVisibleflex: false, //作业流自动配置弹框
					activeflex: 1, //作业流当前步骤
					formdata1flex: {}, //作业流自动配置第一步数据
					formdata2flex: {}, //作业流自动配置第二步数据
					editDowIndexflex: 0,
					data2flex: [], //作业流配置列表
					visibleFlowflex: false, //依赖作业流弹框
					// 依赖作业流查询
					jobFieldDatasflex: [{
						placeholder: '作业流名称',
						field: 'groupName',
						type: 'input'
					}],
					//引入依赖作业start
					jobButtonsflex: [{
						label: '搜索',
						op: 'submit',
						type: 'primary',
						click: function(model, valid) {
							model.appCode = _this.searchFormdata.appCode;
							var param = {
								condition: JSON.stringify(model)
							};
							_this.$refs.jobTableRefflex.remoteData(param);
						}
					}, {
						label: '确定',
						op: 'submit',
						type: 'primary',
						click: function(model, valid) {
							 
							var newlist = [];
							var hadlist = [];
							var selectArr = _this.$refs.jobTableRefflex.selections;
							var currentlist = _this.data2flex || [];
							for (var item in selectArr) {
								var flag = false;
								for (var it in currentlist) {
									if (selectArr[item].groupCode == currentlist[it].groupCode) {
										flag = true;
									}
								}
								if (!flag) {
									_this.getTaskInfo(selectArr[item].appCode, selectArr[item].groupCode);
									newlist.push({
										'groupCode': selectArr[item].groupCode,
										'groupName': selectArr[item].groupName,
										'time1': '',
										'offSet': _this.formDataTask.offSet,
										'isOld': true,
										'formDataTask': taskft
									});
								} else {
									hadlist.push(selectArr[item]);
								}
							}
							if (hadlist && hadlist.length > 0) {
								var sb = '作业流编码为：' + hadlist[0].groupCode + '已引入，请先删除！'
								_this.$message({
									message: sb,
									type: 'warning'
								});
								return;
							} else {
								_this.data2flex = _this.data2flex.concat(newlist);
							}
							_this.visibleFlowflex = false;
						}
					}],
					// 依赖作业查询url
					jobDataUrlflex: "api/use/plats/workflow/queryList",
					jobFieldColumnsflex: [{
							label: '系统编码',
							prop: 'appCode'
						},
						{
							label: '系统名称',
							prop: 'appName'
						},
						{
							label: '作业流代码',
							prop: 'groupCode'
						},
						{
							label: '作业流名称',
							prop: 'groupName'
						}
					],


					visibleFlow: false, //引入作业的弹出框
					addFlag: true, //新增
					active: 1, //当前步骤
					activeflag: false, //请选择依赖作业
					updateFnButton: !yufp.session.checkCtrl('updateFn'),
					deleteFnButton: !yufp.session.checkCtrl('deleteFn'),
					exportCfgFnButton: !yufp.session.checkCtrl('exportCfgFn'),
					importCfgFnButton: !yufp.session.checkCtrl('importCfgFn'),
					jobFlowGuideFnButton: !yufp.session.checkCtrl('jobFlowGuideFn'),
					jobGuideFnButton: !yufp.session.checkCtrl('jobGuideFn'),
					backupFnButton: !yufp.session.checkCtrl('backupFn'),//备份
					restoreFnButton: !yufp.session.checkCtrl('restoreFn'),//还原
					searchFormdata: {},
					dataUrl: 'api/use/citiccard/jobconf/list',
					treeDataUrl: "api/use/plats/event/queryTreeList",
					formdata1: {},
					formdata2: {
						jiqunVal: ''
					},
					formdata3: {
						jiqunVal: ''
					},
					setp3flowCodeList: [], //第三部的作业流编码列表
					sqlc: {
						content: '' //执行内容
					},
					showContent: false, //展示作业执行内容
					agentIds: [], //集群代理名称列表
					groupCodeList: [], //作业流列表
					jobList: [], //作业类型
					startFlagList: [ //作业流开始节点标志（'1'/是，'0'/否，''/默认）//引入为默认 不可修改
						{
							'label': '默认',
							'value': ''
						},
						{
							'label': '是',
							'value': '1'
						},
						{
							'label': '否',
							'value': '0'
						}
					],
					jiqun: [{
							'label': '集群1',
							'value': '1'
						},
						{
							'label': '集群2',
							'value': '2'
						},
						{
							'label': '集群3',
							'value': '3'
						}
					],
					data2: [
						/* {'agentCode':'','groupCode':'','actionName':'','actionCode':'','jobTypeCode':'','actionExec':'','isOld':false,startFlag:'0'} */
					], //作业基本信息内容
					data3: [{
							'groupCode': '',
							'actionCode': '',
							'dependencyType':'',
							'srcTab': '',
							'srcTabs':[],
							'targetTab':'',
							'targetTabs':[],//目标表列表
							'relJobList': [],//作业依赖列表
							'relGroupCode':'' ,
							'relJobCode': '' ,
							'eventCode': '' ,
							'eventName': '' ,
							'relEventList': [],
							'joblist3op':[],
							'joblist3': []
					}], //作业基本信息内容
					editDowIndex: 0, //默认选择编辑第一行参数内容
					editDowIndex3: 0, //默认选择编辑第一行参数内容
					// 选择作业查询
					jobFieldDatas2: [
							{
								placeholder: '作业流编码',
								field: 'groupCode',
								type: 'input'
							},
							{
								placeholder: '作业流名称',
								field: 'groupName',
								type: 'input'
							},
							{
								placeholder: '作业编码',
								field: 'actionCode',
								type: 'input'
							},{
								placeholder: '作业名称',
								field: 'actionName',
								type: 'input'
							}
					],
					// 依赖作业查询
					jobFieldDatas: [{
							placeholder: '应用系统',
							field: 'appCode',
							type: 'select',
							width:'200px',
							options:[{'key':'','value':'全部'}]
						  },{
								placeholder: '作业流编码',
								field: 'groupCode',
								type: 'input'
							},
							{
								placeholder: '作业流名称',
								field: 'groupName',
								type: 'input'
							},
							{
								placeholder: '作业编码',
								field: 'actionCode',
								type: 'input'
							},
							{
								placeholder: '作业名称',
								field: 'actionName',
								type: 'input'
							}
					],
					FlagingData:[{
						placeholder: '作业名称',
						field: 'actionName',
						type: 'input'
					}],
					jobButtonsing: [{
						label: '搜索',
						op: 'submit',
						type: 'primary',
						click: function(model, valid) {
							      var hadJobDataOld = _this.hadJobDataOld ||[];
								  var hadJobDataNew = [];
								if(model.actionName){
										for(var it in hadJobDataOld){
											  if(model.actionName == hadJobDataOld[it].actionName ||
														hadJobDataOld[it].actionName.toLowerCase().indexOf(model.actionName.toLowerCase()) != -1){
												   hadJobDataNew.push(hadJobDataOld[it]);
											  }
										}
									
									_this.hadJobData = hadJobDataNew;
									
								}else{
									_this.hadJobData = hadJobDataOld;
								}
						  },
						},{
						label: '确定',
						op: 'submit',
						type: 'primary',
						click: function(model, valid) {
							var selectArr = _this.$refs.jobTableRefFlaging.selections || [];
							if (selectArr.length > 0) {
								var current = _this.data3[_this.editDowIndex3];
								var oldrelList = _this.JobShowData ||[];
								//自己不能依赖自己
								var fg = true;
								for(var i in selectArr){
									  if(selectArr[i].actionCode == current.jobCode && selectArr[i].groupCode == current.groupCode){
										  fg = false;
										  break;
									  }
									
								}
								if(!fg){
									_this.$message({
										message: '作业不能依赖本身！',
										type: 'warning'
									});
									return;
								}
								//过滤出已存在的依赖
								var jobs = [];
								var relJobs = '';//作业依赖字符串
								var relJobNames = '';//作业依赖字符串
								var relGroups = '';//作业流依赖字符串
								
								for(var i in selectArr){
									 var fs = false;
									 for(var o in oldrelList){
										 if(selectArr[i].actionCode == oldrelList[o].relJobCode 
										    &&  selectArr[i].groupCode == oldrelList[o].relGroupCode
											&&  selectArr[i].appCode == oldrelList[o].relAppCode){
											fs = true;
											 break;
										 }
									
									 }
									 if(!fs){
										 jobs.push({
											'relAppCode':selectArr[i].appCode || '',
											'relGroupCode':selectArr[i].groupCode ||'',
											'relJobCode':selectArr[i].actionCode ||'',
											'relJobName':selectArr[i].actionName ||'',
										});
										if(selectArr[i].actionCode){
											relJobs = relJobs + selectArr[i].actionCode +';';
										}
										if(selectArr[i].actionName){
											relJobNames = relJobNames + selectArr[i].actionName +';';
										}
										 if(selectArr[i].groupCode){
										 	relGroups = relGroups + selectArr[i].groupCode +';';
										 }
									 }
												
								}
								_this.JobShowData = _this.JobShowData.concat(jobs);
	/* 							_this.data3[_this.editDowIndex3].relJobList = _this.data3[_this.editDowIndex3].relJobList.concat(jobs);
								if(relJobs){
									_this.data3[_this.editDowIndex3].relJobCode = _this.data3[_this.editDowIndex3].relJobCode+relJobs;
								}
								if(relGroups){
									_this.data3[_this.editDowIndex3].relGroupCode = _this.data3[_this.editDowIndex3].relGroupCode+relGroups;
								} */
							}
							
							_this.$refs.jobTableRefFlaging.selections.splice(0);
							_this.activeflag = false;

						}
					}],
					//引入依赖作业start
					jobButtons: [{
						label: '搜索',
						op: 'submit',
						type: 'primary',
						click: function(model, valid) {
							//第二步需要引入作业（当前系统），第三部也需要引入依赖的作业（所有系统）
							if (_this.active == 2) {
								model.appCode = _this.searchFormdata.appCode;
								var param = {
									condition: JSON.stringify(model)
								};
								_this.$refs.jobTableRef.remoteData(param);
							} else { //第三部，可以依赖其他系统
								var param = {
									condition: JSON.stringify(model)
								};
								_this.$refs.jobTableRefFlag.remoteData(param);
							}
						}
					}, /* {
						label: '清空',
						op: 'submit',
						type: 'primary',
						click: function(model, valid) {
							if(_this.active == 3){
						 		_this.data3[_this.editDowIndex3].relJobList = [];
								_this.data3[_this.editDowIndex3].relGroupCode = '';
								_this.data3[_this.editDowIndex3].relJobCode = ''; //依赖系统编号	 						   
								_this.activeflag = false;
								
							}

						}
					}, */{
						label: '确定',
						op: 'submit',
						type: 'primary',
						click: function(model, valid) {

							if (_this.active == 2) { //第二步的引入作业
								var newlist = [];
								var hadlist = [];
								var selectArr = _this.$refs.jobTableRef.selections;
								var currentlist = _this.data2 || [];
								for (var item in selectArr) {
									var flag = false;
									for (var it in currentlist) {
										if (selectArr[item].groupCode == currentlist[it].groupCode && selectArr[item].actionCode ==
											currentlist[it].actionCode) {
											flag = true;
										}
									}
									if (!flag) {
										var tone = selectArr[item];
										var workBaseFormData = {
											typeCode:tone.typeCode || 'C',
											success: tone.success,
											actionPrior: tone.actionPrior,
											maxRetry: tone.maxRetry,
											multiFlag: tone.multiFlag,
											intrFlag: tone.intrFlag,
											condType: tone.condType,
											remark: tone.remark
										}; //作业基本信息
										//通过作业流编码  系统编码  作业编码查询该作业的事件和参数
										_this.getRelData(tone.actionCode, tone.groupCode);
										var workExecFormData = {
											'wftParList': _this.getData.wftParList || [],
											'useEventCrossList': _this.getData.useEventCrossList || []
										};
										var limitBegin = tone.limitBegin;
										var limitEnd = tone.limitEnd;
										var limitInfo = tone.limitInfo;
										var timepicker = [];
										timepicker.push(new Date(2020, 5, 29, limitBegin.substring(0, 2), limitBegin.substring(2, 4),
											limitBegin.substring(4, 6)));
										timepicker.push(new Date(2020, 5, 29, limitEnd.substring(0, 2), limitEnd.substring(2, 4), limitEnd.substring(
											4, 6)));
										var i = 0;
										var timeList = [];
										while (limitInfo && i < limitInfo.trim().length) {

											if ((limitInfo.slice(i, i + 4)).indexOf('@DT') > -1) {
												var value = '';
												for (var j in _this.dateTypeOptions) {
													if (_this.dateTypeOptions[j].key == (limitInfo.slice(i, i + 4)).split('@DT')[1]) {
														value = _this.dateTypeOptions[j].value;
														break;
													}
												}
												timeList.push({
													key: limitInfo.slice(i, i + 4),
													value: value
												});
											} else if ((/^[0-9]+$/.test(limitInfo.slice(i, i + 4)))) {
												timeList.push({
													key: limitInfo.slice(i, i + 4),
													value: limitInfo.slice(i, i + 4).slice(0, 2) + '月' + limitInfo.slice(i, i + 4).slice(2, 4) +
														'日'
												});
											} else {
												timeList.push({
													key: limitInfo.slice(i, i + 4),
													value: yufp.lookup.convertKey('USE_FIXED_TIME_RANGE', limitInfo.slice(i, i + 4).slice(0, 1)) +
														yufp.lookup.convertKey('USE_FIXED_TIME_F', limitInfo.slice(i, i + 4).slice(1, 2)) + limitInfo.slice(
															i, i + 4).slice(2, 4) + '天'
												});
											}
											i = i + 4;
										}
										var workAdditionalFormData = {
											'timepicker': timepicker,
											'timeList': timeList
										}; //作业附件限制																																																
										newlist.push({
											'agentCode': selectArr[item].agentCode || '',
											'groupCode': selectArr[item].groupCode,
											'groupName': selectArr[item].groupName,
											'actionName': selectArr[item].actionName || '',
											'actionCode': selectArr[item].actionCode || '',
											'jobTypeCode': ' ',
											'actionExec': selectArr[item].actionExec || '',
											'isOld': true,
											'startFlag': '',
											workBaseFormData,
											workExecFormData,
											workAdditionalFormData
										});
									} else {
										hadlist.push(selectArr[item]);
									}
								}
								if (hadlist && hadlist.length > 0) {
									var sb = '作业流编码为：' + hadlist[0].groupCode + ',作业编码为' + hadlist[0].actionCode + '已引入，请先删除！'
									_this.$message({
										message: sb,
										type: 'warning'
									});
									return;
								} else {
									_this.data2 = _this.data2.concat(newlist);
								}
								_this.visibleFlow = false;

							} else { //第三部的选择
								var selectArr = _this.$refs.jobTableRefFlag.selections || [];
								if (selectArr.length > 0) {
									var current = _this.data3[_this.editDowIndex3];
									var oldrelList = _this.JobShowData ||[];
									//自己不能依赖自己
									var fg = true;
									for(var i in selectArr){
										  if(selectArr[i].actionCode == current.jobCode && selectArr[i].groupCode == current.groupCode){
											  fg = false;
											  break;
										  }
										
									}
									if(!fg){
										_this.$message({
											message: '作业不能依赖本身！',
											type: 'warning'
										});
										return;
									}
									//过滤出已存在的依赖
									var jobs = [];
									var relJobs = '';//作业依赖字符串
									var relJobNames = '';//作业依赖字符串
									var relGroups = '';//作业流依赖字符串
									
									for(var i in selectArr){
										 var fs = false;
										 for(var o in oldrelList){
											 if(selectArr[i].actionCode == oldrelList[o].relJobCode 
											    &&  selectArr[i].groupCode == oldrelList[o].relGroupCode
												&&  selectArr[i].appCode == oldrelList[o].relAppCode){
												fs = true;
												 break;
											 }
		
										 }
										 if(!fs){
											 jobs.push({
												'relAppCode':selectArr[i].appCode || '',
												'relGroupCode':selectArr[i].groupCode ||'',
												'relJobCode':selectArr[i].actionCode ||'',
												'relJobName':selectArr[i].actionName ||'',
											});
											if(selectArr[i].actionCode){
												relJobs = relJobs + selectArr[i].actionCode +';';
											}
											if(selectArr[i].actionName){
												relJobNames = relJobNames + selectArr[i].actionName +';';
											}
											 if(selectArr[i].groupCode){
											 	relGroups = relGroups + selectArr[i].groupCode +';';
											 }
										 }
					
									}
									_this.JobShowData = _this.JobShowData.concat(jobs);
/* 									_this.data3[_this.editDowIndex3].relJobList = _this.data3[_this.editDowIndex3].relJobList.concat(jobs);
									if(relJobs){
										_this.data3[_this.editDowIndex3].relJobCode = _this.data3[_this.editDowIndex3].relJobCode+relJobs;
									}
									if(relGroups){
										_this.data3[_this.editDowIndex3].relGroupCode = _this.data3[_this.editDowIndex3].relGroupCode+relGroups;
									} */
								}
								_this.activeflag = false;
							}
						}
					}],
					// 依赖作业查询url
					jobDataUrl: "api/use/plats/workflow/queryFlowAllNodeListByPage",
					jobFieldColumns: [{
							label: '应用系统',
							prop: 'appCode'
						},
						{
							label: '应用系统名称',
							prop: 'appName'
						},
						{
							label: '作业流代码',
							prop: 'groupCode'
						},
						{
							label: '作业流名称',
							prop: 'groupName'
						},
						{
							label: '作业编号',
							prop: 'actionCode'
						},
						{
							label: '作业名称',
							prop: 'actionName'
						}
					],
					options: [{
						key: 'Y',
						value: '是'
					}, {
						key: 'N',
						value: '否'
					}],
					dutytwoParams:{
						condition: JSON.stringify({
							appCode: ''
						})
					},
					// 事件窗口
					eventVisible: false,
					// 事件查询
					eventFieldDatasRel:[{
						placeholder: '应用系统',
						field: 'appCode',
						type: 'select',
						options:[{'key':'','value':'全部'}]
					  },{
						placeholder: '事件名称',
						field: 'eventName',
						type: 'input'
					  },{
						placeholder: '事件代码',
						field: 'eventCode',
						type: 'input'
					  }],
					eventFieldDatas: [{
						placeholder: '事件名称',
						field: 'eventName',
						type: 'input'
					},{
						placeholder: '事件代码',
						field: 'eventCode',
						type: 'input'
					},{
						placeholder: '事件类型',
						field: 'eventType',
						value:'G',
						type: 'input',
						hidden:true
					}],
					// 事件查询按钮
					dutyTableParams: {
						condition: JSON.stringify({
							appCode: '',
							eventType: 'G'
						})
					},
					baseGroupParams: {
						condition: JSON.stringify({
							appCode: ''
						})
					},
					eventButtons: [{
						label: '搜索',
						op: 'submit',
						type: 'primary',
						click: function(model, valid) {
							if (_this.active == 2) {
								model.appCode = _this.searchFormdata.appCode;
								var param = {
									condition: JSON.stringify(model)
								};
								_this.$refs.eventTableRef.remoteData(param);
							} else {
								var param = {
									condition: JSON.stringify(model)
								};
								_this.$refs.eventTableRefRef.remoteData(param);
							}
						}
					},/* {
						label: '清空',
						op: 'submit',
						type: 'primary',
						click: function(model, valid) {
							if(_this.active == 3){
						 		_this.data3[_this.editDowIndex3].relEventList = [];
								_this.data3[_this.editDowIndex3].eventCode = '';
								_this.data3[_this.editDowIndex3].eventName = ''; //依赖系统编号	 						   
								_this.eventVisibleRef = false; 		
							}

						}
					}, */ {
						label: '确定',
						op: 'submit',
						type: 'primary',
						click: function(model, valid) {
							if (_this.active == 2) {
								var selectArr = _this.$refs.eventTableRef.selections;
								if (selectArr.length < 1) {
									_this.$message('请先选择数据');
									return;
								}
								var selCHeck = [];
								if (!_this.getData.useEventCrossList) {
									_this.getData.useEventCrossList = [];
								}
								yufp.clone(_this.getData.useEventCrossList, selCHeck);
								for (var i = 0; i < selectArr.length; i++) {
									var flag = true;
									for (var j = 0; j < selCHeck.length; j++) {
										if (selCHeck[j].eventCode == selectArr[i].eventCode) {
											flag = false;
										}
									}
									if (flag) {
										selectArr[i].eventApp = selectArr[i].appCode;
										selectArr[i].relation = 'T';
										_this.getData.useEventCrossList.push(selectArr[i]);
									}
								}
								_this.eventVisible = false;
							} else {   //选择依赖的事件
								var selectArr = _this.$refs.eventTableRefRef.selections || [];
								if (selectArr.length > 0) {
									var current = _this.data3[_this.editDowIndex3];
									var oldrelList = current.relEventList ||[];
									//过滤出已存在的依赖
									var jobs = [];
									var relJobs = '';//作业依赖字符串
									var relGroups = '';//作业流依赖字符串
									
									for(var i in selectArr){
										 var fs = false;
										 for(var o in oldrelList){
											 if(selectArr[i].eventCode == oldrelList[o].eventCode 
											    &&  selectArr[i].eventType == oldrelList[o].eventType
												&&  selectArr[i].appCode == oldrelList[o].eventAppCode){
												fs = true;
												 break;
											 }
										
										 }
										 if(!fs){
											 jobs.push({
												'eventAppCode':selectArr[i].appCode,
												'eventCode':selectArr[i].eventCode,
												'eventName':selectArr[i].eventName,
												'eventType':selectArr[i].eventType
											});
											if(selectArr[i].eventCode){
												relJobs = relJobs + selectArr[i].eventCode +';';
											}
											 if(selectArr[i].eventName){
											 	relGroups = relGroups + selectArr[i].eventName +';';
											 }
										 }
													
									}
									_this.EventShowData =_this.EventShowData.concat(jobs);
/* 									_this.data3[_this.editDowIndex3].relEventList = _this.data3[_this.editDowIndex3].relEventList.concat(jobs);
									if(relJobs){
										_this.data3[_this.editDowIndex3].eventCode = _this.data3[_this.editDowIndex3].eventCode+relJobs;
									}
									if(relGroups){
										_this.data3[_this.editDowIndex3].eventName = _this.data3[_this.editDowIndex3].eventName+relGroups;
									} */
								}
								_this.eventVisibleRef = false; 
							}



						}
					}],
					// 依赖作业查询url
					eventDataUrl: "api/use/plats/event/queryList",
					eventFieldColumns: [{
							label: '应用系统',
							prop: 'appCode'
						},
						{
							label: '应用系统名称',
							prop: 'appName'
						},
						{
							label: '事件代码',
							prop: 'eventCode'
						},
						{
							label: '事件名称',
							prop: 'eventName'
						},
						{
							label: '事件路径',
							prop: 'folderPath'
						},
						{
							label: '事件类型',
							prop: 'eventType',
							dataCode: "USE_EVENT_TYPE"
						}
					],
					isModify: true,
					radio1: true,
					radio2: true,
					radio3: true,
					currentTips: '',
					rules: {
						paramName: [{
							required: true,
							message: '请输入参数名称',
							trigger: 'blur'
						}],
						paramValue: [{
							required: true,
							message: '请输入参数值',
							trigger: 'blur'
						}]
					},
					timeList: [],
					selectTime: {},
					//引入依赖作业end
					/*作业高级信息的弹框信息 star*/
					tabsValue: 'baseMsg',
					workBaseFormData: {},
					workExecFormData: {
						actionLoc: ''
					},
					workAdditionalFormData: {
						radio1: '1',
						radio2: '',
						radio3: '',
						limitEnd: '',
						limitBegin: ''
					},
					dateTypeOptions: [],
					workData: {},
					formDisabled: false,
/* 					editDowIndex: 0, //默认选择编辑第一行参数内容 */
					ruleslist: {
						actionCode: [{
							validator: valiCodes,
							trigger: 'blur'
						}]
					},
					dialogDetail: false, //作业内容的弹框
					getData: {
						wftParList: [],
						useEventCrossList: [],
						autoUseEventCrossList: []
					},
					disabledOpr: false,
					limit: {
						validator: limit,
						trigger: 'blur'
					},
					rule: [{
							required: true,
							validator: check,
							trigger: 'blur'
						},
						{
							validator: numMax,
							trigger: 'blur'
						}
					],
					//校验天规则
					dayRules: [{
						validator: this.numCheck,
						trigger: 'blur'
					}],
					isHiddenAction: false,
					isHiddenActionSelect: false,
					actionLocOptions: [],
					isProcess: false,
					paramObj: {
						appCode: ''
					},
					editDowIndexX: 0, //默认选择编辑第一行参数内容
					editDowIndexX2:0,
					timepicker: [], //时间选择器
					/*作业高级信息的弹框信息 end*/
					appNameDisabled: false,
					recordBtnShow: false,
					deleteBtnShow: false,
					addBtnShow: false,
					currentClickNode: {},
					formdata: {},
					async: false,
					param: {
						UNITID: '0000',
						LEVELUNIT: '1'
					},
					dialogVisible: false,
					//eventTypeOption: eventTypeOption,
					viewTitleArrry: ['普通事件监控'],
					viewTitle: '',
					isAppNode: false,
					eventFiles: [],
					currAppNode: {},
					intervalSelection: {
						key: '60000',
						label: '60秒'
					},
					refreshIntervalOptions: [{
						key: '864000000',
						label: '不自动刷新'
					}, {
						key: '10000',
						label: '10秒'
					}, {
						key: '20000',
						label: '20秒'
					}, {
						key: '30000',
						label: '30秒'
					}, {
						key: '60000',
						label: '60秒'
					}],
				};
			},
			mounted() {
				var _this = this;
				 //为页面增加ctrl +V的粘贴事件
				 _this.addParse();
				_this.workAdditionalFormData.radio1 = '1';
				
				_this.getappList();
				
				
				//测试
				_this.$nextTick(function(){
						var tableBox = _this.$refs.tableBox;
						let a = tableBox.getBoundingClientRect().top + 28;
						var theight = `calc(100vh - ${a}px - 64px)`;
						_this.tbHeight = theight;		
				});
			},
			created: function() {
				var _this = this;
				_this.queryWftAgtList();
				yufp.service.request({
					url: backend.useService + '/plats/calendar/queryUseCalendarTypeList',
					method: 'get',
					data: {
						appCode: data.appCode
					},
					callback: function(code, message, response) {
						if (response && response.data) {
							for (var i = 0; i < response.data.length; i++) {
								_this.dateTypeOptions.push({
									key: response.data[i].typeCode,
									value: response.data[i].typeName
								});
							}
						}
					}
				});
			},
			watch: {
				timeList: function(val) {
					var _this = this;
					_this.workAdditionalFormData.timeList = val;
				},
				'workAdditionalFormData.radio1': function(val, o) {
					if (val) {
						this.workAdditionalFormData.radio2 = '';
						this.workAdditionalFormData.radio3 = '';
						this.radio1 = false;
						this.radio2 = true;
						this.radio3 = true;
					}
					if (this.workAdditionalFormData.radio2 == '' && this.workAdditionalFormData.radio3 == '') {
						this.workAdditionalFormData.radio1 = '1';
					}
				},
				'workAdditionalFormData.radio2': function(val) {
					if (val) {
						this.workAdditionalFormData.radio1 = '';
						this.workAdditionalFormData.radio3 = '';
						this.radio1 = true;
						this.radio2 = false;
						this.radio3 = true;
					}
				},
				'workAdditionalFormData.radio3': function(val) {
					if (val) {
						var _this = this;
						_this.workAdditionalFormData.radio1 = '';
						_this.workAdditionalFormData.radio2 = '';
						_this.radio1 = true;
						_this.radio2 = true;
						_this.radio3 = false;
					}
				}
			},
			methods: {
				//备份
				backupFn:function(){
					var _this = this;
					_this.backupDialogVisible = true;
					
				},
				restoreFn:function(){
					var _this = this;
					_this.restoreDialogVisible = true;
					
				},
				successUploadBack: function(response, file, fileList) { //导入成功后执行
					var _this = this;
						_this.$refs['my-upload-back'].clearFiles();
						yufp.util.download("api/use/citiccard/jobconfbak/backupConfig?filePath=" + response.data.filePath);
						_this.backupDialogVisible = false;

				},
				successUploadStore: function(response, file, fileList) { //导入成功后执行
					const _this = this;
					yufp.service.request({
						method: 'POST',
						url: '/api/use/citiccard/jobconfbak/recoverConfig',
						data: response.data,
						callback: function(code, message, response) {
							if (response.code == 0) {
								_this.$refs['my-upload-restore'].clearFiles();
								_this.restoreDialogVisible = false;
							} else {
								_this.restoreDialogVisible = false;
								_this.$message('导入失败!');
							}
						}
					});
				},
				getappList:function(){ //获取
								var _this = this;
								yufp.service.request({
									url:'api/use/plats/event/queryTreeList',
									method: 'get',
									data: {
									},
									callback: function(code, message, response) {
										if(response && response.data && response.data.length  > 0){
											var sl = [{'key':'','value':'全部'}];
											for(var it in response.data){
												var key = response.data[it].appCode;
												var value = response.data[it].appName;
												sl.push({'key':key,'value':value});
											}
											_this.eventFieldDatasRel[0].options = sl ;
											_this.jobFieldDatas[0].options = sl ;
										}
									},
								});
				},
				getCurrentRel:function(groupCode,jobCode,relList){ //根据源表，找其他的目标表，如果相同，则增加作业依赖
					 var _this = this;
					 var allRel =[];
					 var data3 = _this.data3 || [];					 
					 for(var im in relList){
						  var st = relList[im];
						  for(var item in data3){
							  //去掉依赖本身
							  if('SRCTAB' == data3[item].dependencyType){
							  if(groupCode == data3[item].groupCode && jobCode == data3[item].jobCode){
								  console.log('同一作业忽略。。。');
							  }else{
									   var targetTabs = data3[item].targetTabs || [];
									   //判断srcTab源表在targetTabs目标表中是否存在
									   if(_this.existTarget(st,targetTabs)){
											//找到，就将这条作业作业依赖给源表作业中
											var joblist3 = data3[item].joblist3 || [];
											var relJobName = '';
											for(var a in joblist3){
												if(data3[item].jobCode == joblist3[a].actionCode){
													relJobName = joblist3[a].actionName;
													break;
												}
											}
											var jobRelInfo = {
												   'relAppCode':_this.searchFormdata.appCode,//当前系统
												   'relGroupCode':data3[item].groupCode,
												   'relJobCode':data3[item].jobCode,
												   'relJobName':relJobName,
												   'eventAppCode':'',
												   'eventCode':'',
												   'eventName':'',
												   'eventType':'',
												   'srcTab':st.tabName,
												   'schema':st.schema,
												   'env':st.env
											};
											allRel.push(jobRelInfo);
										   
									   }							  
							  }
							  }
						  }
						 
					 } 
					 return allRel;				
				},
				getDelRel:function(groupCode,jobCode,relList){ //根据源表，找其他的目标表，如果相同，则删除该作业依赖
					 var _this = this;
					 var allRel =[];
					 var data3 = _this.data3 || [];					 
					 for(var im in relList){
						  var st = relList[im];
						  for(var item in data3){
							  //去掉依赖本身
							  if('SRCTAB' == data3[item].dependencyType){
							  if(groupCode == data3[item].groupCode && jobCode == data3[item].jobCode){
								  console.log('同一作业忽略。。。');
							  }else{
									   var targetTabs = data3[item].targetTabs || [];
									   //判断srcTab源表在targetTabs目标表中是否存在
									   if(_this.existTarget(st,targetTabs)){
											//找到，就将这条作业作业依赖给源表作业中
											var jobRelInfo = {
												   'relAppCode':_this.searchFormdata.appCode,//当前系统
												   'relGroupCode':data3[item].groupCode,
												   'relJobCode':data3[item].jobCode,
												   'relJobName':'',
												   'eventAppCode':'',
												   'eventCode':'',
												   'eventName':'',
												   'eventType':'',
												   'srcTab':st.tabName,
												   'schema':st.schema,
												   'env':st.env
											};
											allRel.push(jobRelInfo);
										   
									   }							  
							  }
							  }
						  }
						 
					 } 
					 return allRel;				
				},
				existTarget:function(srcTabone,targetTabs){//判断源表在一组目标表中是否存在
				  var flag = false;
				  if(srcTabone.tabName){
					  for(var it in targetTabs){
						  if(srcTabone.tabName == targetTabs[it].tabName && srcTabone.schema == targetTabs[it].schema && srcTabone.env == targetTabs[it].env){
							  flag = true;
							  break;
						  } 
					  }
				  }
					return flag;
				},
				getLastRel:function(jobRelInfoList,deljobRelInfoList,addList){//本来的依赖-删除的依赖-新增的依赖
						 var newrel = [];//减的结果	
						 //减除依赖
						 for(var o in jobRelInfoList){
							   var ou = jobRelInfoList[o];
							   var flag = false;
								for(var i in deljobRelInfoList){
									 var oi = deljobRelInfoList[i];
									 if(ou.relAppCode == oi.relAppCode && ou.relGroupCode == oi.relGroupCode &&
											ou.relJobCode == oi.relJobCode && ou.srcTab == oi.srcTab &&
											ou.schema == oi.schema && ou.env == oi.env){
										  flag = true;
										  break;
									 }	
								}
								if(!flag){
									newrel.push(ou);
								}							 
						 }
						 //增加依赖
						 var addlist = [];
						 for(var o in addList){
								   var ou = addList[o];
								   var flag = false;
									for(var i in newrel){
										 var oi = newrel[i];
										 if(ou.relAppCode == oi.relAppCode && ou.relGroupCode == oi.relGroupCode &&
												ou.relJobCode == oi.relJobCode && ou.srcTab == oi.srcTab &&
												ou.schema == oi.schema && ou.env == oi.env){
											  flag = true;
											  break;
										 }	
									}
									if(!flag){
										addlist.push(ou);
									}							 
						 }
						 
						 newrel = newrel.concat(addlist);
						return newrel;
				},
				addRelChange:function(type,changeInfo){
					var _this = this;
					var cells = _this.data3[_this.editDowIndex3];
					 if(type == '1'){
						//1源表保存 
						 //循环当前源表,去找其他行的目标表里面找,如果找到,说明找到行的作业是当前行的依赖作业
						 var jobRelInfoList = cells.jobRelInfoList ||[];
						 //源表依赖，查看其它的源表依赖的目标表是否为当前源表，有则需要显示依赖
						 var newjobRelInfoList = _this.getCurrentRel(cells.groupCode,cells.jobCode,changeInfo);
						 //返回需要增加的依赖
						 return newjobRelInfoList;
					 }else if(type == '2'){
						 //2.单个源表删除
						 // 根据删除的源表,去找其他行的目标表里面找,如果找到,说明找到行的作业不是当前行的依赖作业
						 var newrel = [];
						 var jobRelInfoList = cells.jobRelInfoList ||[];
						 var changeInfolist = changeInfo;
						 //返回需要减去的依赖
						 var deljobRelInfoList = _this.getDelRel(cells.groupCode,cells.jobCode,changeInfolist);
						 return deljobRelInfoList 
					 }	
				},
				changeTargetRel:function (oldTar,tar){//修改其他行源表为当前目标表的依赖
					var _this = this;
					var cells = _this.data3[_this.editDowIndex3];//当前行
					//1. 先减掉所有依赖老的目标表的（将当前行的依赖减掉）
					//去掉依赖本身
					for(var o in oldTar){
						  var oldData3 = _this.data3 || [];
						  var tarone = oldTar[o];
						  for(var t in oldData3){
							   var flexone = oldData3[t];
							   if('SRCTAB' == flexone.dependencyType){ //只处理源表
									if(cells.groupCode == flexone.groupCode && cells.jobCode == flexone.jobCode){
												//console.log('同一作业忽略。。。');
									}else{
										 var delone = _this.getTarDelResult(tarone,flexone,cells,'del');//获取删除后的结果
										 if(delone.change){//如果变了就更新
											 _this.data3[t] = delone.jp;
										 }
									}
							   }
						  }
					}		
					//2.在新增所有（哪条作业的源表是该目标表，就将改作业增加到那条作业的依赖中）
					for(var o in tar){
						  var oldData3 = _this.data3 || [];
						  var tarone = tar[o];
						  for(var t in oldData3){
							   var flexone = oldData3[t];
							   if('SRCTAB' == flexone.dependencyType){ //只处理源表
									if(cells.groupCode == flexone.groupCode && cells.jobCode == flexone.jobCode){
												//console.log('同一作业忽略。。。');
									}else{
										 var delone = _this.getTarDelResult(tarone,flexone,cells,'add');//获取删除后的结果
										 if(delone.change){//如果变了就更新
											 _this.data3[t] = delone.jp;
										 }
									}
							   }
						  }
					}
					
				},
				getTarDelResult(tarone,flexone,cells,type){//获取删除后的结果
					var _this = this;
					var change = false;
					var jp= {};
					var srcTabs = flexone.srcTabs;
					var jobRelInfoList = flexone.jobRelInfoList;
					var newjobRelInfoList = []; 
					//判断该目标表在当前元表中是否存在
					if(_this.existTarget(tarone,srcTabs)){
						 if(type =='del'){
							  //将以依赖删除，
							  for(var item in jobRelInfoList){
									var rel = jobRelInfoList[item];					  
									if(_this.searchFormdata.appCode == rel.relAppCode && cells.groupCode == rel.relGroupCode &&
										cells.jobCode == rel.relJobCode && tarone.tabName == rel.srcTab &&
										tarone.schema == rel.schema &&　tarone.env == rel.env){
												change　= true;						
									}else{
										newjobRelInfoList.push(rel);
									}	  
							  }	
					 
						 }else{ //add
							 //将依赖增加
							 var joblist3 = cells.joblist3 || [];
							 var relJobName = '';
							 for(var a in joblist3){
							 	if(cells.jobCode == joblist3[a].actionCode){
							 		relJobName = joblist3[a].actionName;
							 		break;
							 	}
							 }
							 var jobRelInfoOne = {
							 	   'relAppCode':_this.searchFormdata.appCode,//当前系统
							 	   'relGroupCode':cells.groupCode,
							 	   'relJobCode':cells.jobCode,
							 	   'relJobName':relJobName,
							 	   'eventAppCode':'',
							 	   'eventCode':'',
							 	   'eventName':'',
							 	   'eventType':'',
							 	   'srcTab':tarone.tabName,
							 	   'schema':tarone.schema,
							 	   'env':tarone.env
							 };
							 //判断该依赖在其中是否存在
							 var fgs = false;
							 for(var im in jobRelInfoList){
								 var old = jobRelInfoList[im]
								 if(old.relAppCode == jobRelInfoOne.relAppCode && old.relGroupCode == jobRelInfoOne.relGroupCode &&
									old.relJobCode == jobRelInfoOne.relJobCode){
									 fgs = true;
									 break;
								 }	 
							 }
							 if(!fgs){
								 change = true;
								 jobRelInfoList.push(jobRelInfoOne);
								 newjobRelInfoList = jobRelInfoList;
							 }
						 }
					}else{
						change = false;
					}
					if(change){ //改变了根据新的依赖解析出新的关系
						var jx = _this.getRelJson(flexone.dependencyType,newjobRelInfoList);						 
						 //*根据解析的结果判断当前源表是否存在依赖 start*/
						 var tableInfos = flexone.srcTabs;//同时将存在关系也删除
						 for(var o in tableInfos){
						 	var isexist = 'N';
						 	for(var i in newjobRelInfoList){
						 		if(tableInfos[o].tabName == newjobRelInfoList[i].srcTab &&
						 			tableInfos[o].env == newjobRelInfoList[i].env &&
						 			tableInfos[o].schema == newjobRelInfoList[i].schema){
						 				if( newjobRelInfoList[i].relJobCode || newjobRelInfoList[i].eventCode){//依赖作业和事件存在一个即使存在依赖关系
						 					isexist = 'Y';
						 					break;
						 				}	
						 		}				
						 	}
						 	if(isexist == 'Y'){
						 		tableInfos[o].existsFlag = 'Y';					
						 	}else{
						 		tableInfos[o].existsFlag = 'N';
						 	}
						 }
						// _this.data3[_this.editDowIndex3].srcTabs = tableInfos;
						 /*根据解析的结果判断当前源表是否存在依赖 end*/
												 
												 
						 jp = {
						 	'jobCode': flexone.jobCode,//备用字段  actionCode为空（不知原因）
						 	'actionName':flexone.actionName,
						 	'groupCode': flexone.groupCode,
						 	'actionCode':flexone.actionCode,
						 	'dependencyType':flexone.dependencyType,
						 	'srcTab': flexone.srcTab,
						 	'srcTabs':tableInfos,
						 	'targetTab': flexone.targetTab,
						 	'targetTabs':flexone.targetTabs,//目标表列表
						 	'relJobList': jx.relJobList,//作业依赖列表
						 	'relGroupCode':jx.relGroups ,
						 	'relJobCode': jx.relJobs ,
						 	'relJobName': jx.relJobNames ,
						 	'eventCode': jx.relEvents ,
						 	'eventName': jx.relEventNames ,
						 	'relEventList': jx.relEventList,
						 	'joblist3': flexone.joblist3,
							'joblist3op':[{'actionCode':flexone.jobCode,'actionName':flexone.actionName}],
						 	'jobRelInfoList':newjobRelInfoList ||[]
						 }; 
						
					}
					
					return {'change':change,'jp':jp};
				},
				viewRel:function(cells){//查看依赖列表
					//console.log('cells',cells);
					var _this = this;
					_this.$nextTick(function(){
						var cells = _this.data3[_this.editDowIndex3];
						 _this.jobCodeDetail = '';
						//判断依赖类型
						var type = cells.dependencyType;
						_this.relType = type;
						if(type == 'SRCTAB'){
							_this.reltitle ='源表依赖查看';
						}else if(type == 'GERERAL'){
							_this.reltitle ='作业依赖查看';
						}else if(type == 'EVENT'){
							_this.reltitle ='事件依赖查看'
						}else{
							reltitle = '未知类型';
						}
						_this.viewRelDialog = true;
						 var jobcode = cells.jobCode || '';
						_this.groupCodeDetail = cells.groupCode || '';
						var joblist3 = cells.joblist3 ||[]; //根据作业编码获取作业名称
						for(var item in joblist3){
							if(joblist3[item].actionCode == jobcode){
								 _this.jobCodeDetail = joblist3[item].actionName || '';
								 break;
							}
						}
						if(!_this.jobCodeDetail){
							_this.jobCodeDetail = _this.data3[_this.editDowIndex3].actionName || '';
						}
						
						_this.$nextTick(function(){
							var jobRelInfoList = [];
							var relJobList = cells.relJobList || [];
							var relEventList = cells.relEventList || [];
							if('SRCTAB' == type){//源表依赖
									jobRelInfoList = cells.jobRelInfoList ||[];
									//源表依赖，查看其它的源表依赖的目标表是否为当前源表，有则需要显示依赖
									//var newjobRelInfoList = _this.getCurrentRel(cells.groupCode,cells.jobCode,cells.srcTabs);
									//jobRelInfoList = jobRelInfoList.concat(newjobRelInfoList);
							}else if('GERERAL' == type){//作业依赖
							   for(var i in relJobList){
									  //解析作业
									  var relAppCode = '';
									  var relGroupCode = '';
									  var relJobCode = '';
									  var relJobName = '';
									  var eventAppCode = '';
									  var eventCode = '';
									  var eventName = '';
									  var eventType = '';
									  var srcTab = '';
									  var schema = '';
									  var env = '';
									  relAppCode = relJobList[i]. relAppCode;
									  relGroupCode = relJobList[i]. relGroupCode;
									  relJobCode = relJobList[i]. relJobCode;	
									  relJobName = relJobList[i]. relJobName;																
									  var jobRelInfo = {
										   'relAppCode':relAppCode,
										   'relGroupCode':relGroupCode,
										   'relJobCode':relJobCode,
										   'relJobName':relJobName,
										   'eventAppCode':eventAppCode,
										   'eventCode':eventCode,
										   'eventName':eventName,
										   'eventType':eventType,
										   'srcTab':'',
										   'schema':schema,
										   'env':env,
									  };
									  jobRelInfoList.push(jobRelInfo);
							   }
								
							}else if('EVENT' == type){//事件依赖
								for(var i in relEventList){
									  //解析作业
									  var relAppCode = '';
									  var relGroupCode = '';
									  var relJobCode = '';
									  var relJobName = '';
									  var eventAppCode = '';
									  var eventCode = '';
									  var eventName = '';
									  var eventType = '';
									  var schema = '';
									  var env = '';
										eventAppCode = relEventList[i]. eventAppCode;
										eventCode = relEventList[i]. eventCode;
										eventName = relEventList[i]. eventName;
										eventType = relEventList[i]. eventType;								  							  
									  var jobRelInfo = {
										   'relAppCode':relAppCode,
										   'relGroupCode':relGroupCode,
										   'relJobCode':relJobCode,
										   'relJobName':relJobName,
										   'eventAppCode':eventAppCode,
										   'eventCode':eventCode,
										   'eventName':eventName,
										   'eventType':eventType,
										   'schema':schema,
										   'env':env,
									  };
									  jobRelInfoList.push(jobRelInfo);
								}
							}
							_this.viewRelData = jobRelInfoList ||[];
						});			
					})

				},
				relChange: function(event,idx,cell){//依赖类型
					var _this = this;
					code = cell.dependencyType;
					if(event){
						thisRow = cell.index;
						thisval = code;
						return; //下拉框展开不触发改变事件
					}
					//下拉框关闭事件
					if(thisval == code){ //前后一样不改变
						return;
					}
					  _this.resetRef();//重置依赖
/* 					if(cell.dependencyType == 'SRCTAB'){
						
						 
						
					}else if(cell.dependencyType == 'EVENT'){
						
					}else if(cell.dependencyType == 'GERERAL'){
						
					}else{
						return;
					} */
				},
				showSrcTab: function (cellone){ //显示源表的弹出框
					var _this = this;
					if(!cellone.groupCode || !cellone.jobCode ){
						_this.$message({
							message: '请先选择作业流和作业！',
							type: 'warning'
						});
						return;
					}
					setTimeout(function(){
						_this.srcTabData = [];
						_this.showSrcTabDialog = true;
						var srclist = [];
						_this.$nextTick(function(){
							 //拿到源表的信息展示
							 var sts= [];
							var dli = cellone.srcTabs ||[];
							for(var iu in dli){
								  var kson = dli[iu];
								  kson.isAdd = false;
								  sts.push(kson);
							}
							_this.srcTabData = sts;
							
						})
						
					},200);
				},
				addSrctab:function(){//新增
				    //根据作业流获取源表其他值
					this.srcTabData.push({'srcTab':'','env':'','schema':'',isAdd:true,existsFlag:''});
/* 					var cell = this.data3[this.editDowIndex3];
					//1.根据作业流和作业区第二部找作业类型
					var s2 = this.data2 ||[];
					var jobTypeCode = '';
					for(var i in s2){
						if(cell.groupCode == s2[i].groupCode && cell.jobCode == s2[i].actionCode){
							  jobTypeCode = s2[i].jobTypeCode;
							  break;
						}
					}
					if(jobTypeCode){
						var srccell = this.getEnv(jobTypeCode);
						this.srcTabData.push({'srcTab':'','env':srccell.env,'schema':srccell.schema,isAdd:true,existFlag:''});
					}else{
						this.$message({
							message: '其他类型的解析器只能引入源表！',
							type: 'warning'
						});
						return;
					} */	
				},
				getEnv:function(jobTypeCode){//根据作业流获取源表其他值
					var srccell = {'env':'','schema':''};
					var  lp = this.jobList || []; //作业类型列表
 					for(var item in lp){
						  if(lp[item].key == jobTypeCode){
							   srccell.env = lp[item].env || '';
							    srccell.schema = lp[item].schema || '';
								break;
						  }	
					} 
					return srccell;
					
					
				},
				selSrctab:function(){//引入展示引入的弹出框
					var _this = this;
					this.chooseSrcDialogVisible = true;
					_this.$nextTick(function(){
						_this.$refs.querySrcForm.resetFields();
						let model = {};
						var param = {
							condition: JSON.stringify(model)
						};
						_this.$refs.srcTableRef.remoteData(param);	
					})
					
					
				},
				deleteSrctab:function(idx,cell){//删除
					this.srcTabData.splice(idx,1);
				},
				deleteRefJob:function(idx,cell){//删除
					var newsa = [];
					var sa = this.JobShowData ||[];
					for(var i in sa ){
						if(cell.relAppCode ==  sa[i].relAppCode && cell.relGroupCode ==  sa[i].relGroupCode&& cell.relJobCode ==  sa[i].relJobCode  ){
							 
						}else{
							newsa.push(sa[i]);
						}	
					};
						this.JobShowData = newsa;
				},
				deleteRefEvent:function(idx,cell){//删除
					var newsa = [];
					var sa = this.EventShowData ||[];
					for(var i in sa ){
						if(cell.eventAppCode ==  sa[i].eventAppCode && cell.eventCode ==  sa[i].eventCode&& cell.eventType ==  sa[i].eventType  ){
							 
						}else{
							newsa.push(sa[i]);
						}	
					};
					this.EventShowData = newsa;
				},
				cancelSrcTab:function(){//取消
					this.showSrcTabDialog = false;
				},
				cancelRefJob:function(){//取消
					this.relJobShow = false;
				},
				cancelRefEvent:function(){//取消
					this.reEventShow = false;
				},
				saveRefEvent:function(){
					var _this = this;
					var newsrc = _this.EventShowData ||[];					
					var srcnames = [];//最终的源表名称
					var eventCode = newsrc.reduce(function(pre,item){
						if(item.eventCode){
							return pre + item.eventCode+';';	
						}else{
							return pre;
						}
					},'');
					var eventName = newsrc.reduce(function(pre,item){
						if(item.eventName){
							return pre + item.eventName+';';	
						}else{
							return pre;
						}
					},'');
					
					this.data3[this.editDowIndex3].relEventList = newsrc;
					this.data3[this.editDowIndex3].eventName = eventName;
					this.data3[this.editDowIndex3].eventCode = eventCode;
					this.$set(this.data3, this.editDowIndex3, this.data3[this.editDowIndex3]);
					this.reEventShow = false;
				},
				saveRefJob:function(){
					var _this = this;
					var newsrc = _this.JobShowData ||[];					
					var srcnames = [];//最终的源表名称
					var relGroupCode = newsrc.reduce(function(pre,item){
						if(item.relGroupCode){
							return pre + item.relGroupCode+';';	
						}else{
							return pre;
						}
					},'');
					var relJobCode = newsrc.reduce(function(pre,item){
						if(item.relJobCode){
							return pre + item.relJobCode+';';	
						}else{
							return pre;
						}
					},'');
					
					var relJobName = newsrc.reduce(function(pre,item){
						if(item.relJobName){
							return pre + item.relJobName+';';	
						}else{
							return pre;
						}
					},'');
					
					this.data3[this.editDowIndex3].relJobList = newsrc;
					this.data3[this.editDowIndex3].relJobCode = relJobCode;
					this.data3[this.editDowIndex3].relJobName = relJobName;
					this.data3[this.editDowIndex3].relGroupCode = relGroupCode;
					this.$set(this.data3, this.editDowIndex3, this.data3[this.editDowIndex3]);
					this.relJobShow = false;
				},
				addRelEvent:function(){//显示依赖列表
						var _this = this;
							this.dutyTableParams.condition = JSON.stringify({
													appCode: '',
													eventType: 'F'
												})
							this.eventVisibleRef = true;
							_this.$nextTick(function(){
								let model = {};
								var param = {
									condition: JSON.stringify(model)
								};
								_this.$refs.eventTableRefRef.remoteData(param);	
							});
			
				},
				addRelJob:function(){//显示依赖列表
						var _this = this;
						var searchData = {}; 
						var param = {
							condition: JSON.stringify(searchData)
						};
						_this.activeflag = true;
						_this.$nextTick(function(){
						 _this.$refs.jobTableRefFlag.remoteData(param);
						});
			
				},
				saveSrcTab:function(){//保存圆表数据，刷新依赖关系
					var _this = this;
					var newsrc = _this.srcTabData ||[];					
					var srcnames = [];//最终的源表名称
					//解析，组将参数
					var tableInfos = [];
					var vidifg = true;
					for(var item in newsrc){
							//去重
							var fg =false;
							for(var it in tableInfos){
								 if(newsrc[item].tabName == tableInfos[it].tabName &&newsrc[item].env == tableInfos[it].env &&newsrc[item].schema == tableInfos[it].schema  ){
									  fg = true; 
									  vidifg = false;
									  _this.$message({
									  	message: '第'+(Number(item) +1)+'行的数据有重复！',
									  	type: 'warning'
									  });
									  break;
								 }	
							}
							if(fg){
								  break;
							}else{
								tableInfos.push({'tabName':newsrc[item].tabName,'env':newsrc[item].env,'schema':newsrc[item].schema,isAdd:false,existsFlag:''});								
							}	
					}
					if(!vidifg){ //有重复数据，校验不同
						return;
					}
					//if(tableInfos && tableInfos.length > 0){
						yufp.service.request({
							method: 'POST',
							url: 'api/use/citiccard/jobconf/queryJobRelsByTabs',
							data: {'srcTabs':tableInfos},
							callback: function(code, message, response) {
								if (response.code == 0) {
										//将解析的内容追加到事件或者依赖作业中
									_this.setRelAll(response.data || [],tableInfos);
										
								} else {
									_this.$message('解析源表失败!');
								}
							}
						});
				//	}else{
					//	_this.showSrcTabDialog = false;
				//	}
					
					
					
					
				},
				deleteRefAll:function(idx,cells){//删除依赖关系
					var _this = this;
					var editRows = _this.editDowIndex3;
					var editcell = _this.data3[editRows];
					var jobRelInfoList = editcell.jobRelInfoList|| [];//源表的依赖
					var relJobList = editcell.relJobList|| [];//作业的依赖
					var relEventList = editcell.relEventList|| [];//事件的依赖
					var newjobRelInfoList = [];
					var dependencyType = editcell.dependencyType;
					if('SRCTAB' == dependencyType){//删除的依赖为源表依赖
						for(var it in jobRelInfoList){
							var rel = jobRelInfoList[it];
								  if(cells.srcTab == rel.srcTab && cells.env == rel.env &&
										 cells.schema == rel.schema && cells.relAppCode == rel.relAppCode &&
										 cells.relGroupCode == rel.relGroupCode && cells.relJobCode == rel.relJobCode &&
										  cells.eventAppCode == rel.eventAppCode && cells.eventCode == rel.eventCode){
											  //删除该行
								  }else{
									  newjobRelInfoList.push(rel);
								  }	
						}
						//根据依赖类型，解析作业依赖和事件依赖
						var jx = _this.getRelJsonone(dependencyType,newjobRelInfoList);			
						var jp = {
							'jobCode': editcell.jobCode,//备用字段  actionCode为空（不知原因）
							'actionName':editcell.actionName,
							'groupCode': editcell.groupCode,
							'actionCode':editcell.actionCode,
							'dependencyType':editcell.dependencyType,
							'srcTab': editcell.srcTab,
							'srcTabs':editcell.srcTabs,
							'targetTab': editcell.targetTab,
							'targetTabs':editcell.targetTabs,//目标表列表
							'relJobList': jx.relJobList,//作业依赖列表
							'relGroupCode':jx.relGroups ,
							'relJobCode': jx.relJobs ,
							'relJobName': jx.relJobNames ,
							'eventCode': jx.relEvents ,
							'eventName': jx.relEventNames ,
							'relEventList': jx.relEventList,
							'joblist3': editcell.joblist3,
							'joblist3op':[{'actionCode':editcell.jobCode,'actionName':editcell.actionName}],
							'jobRelInfoList':newjobRelInfoList ||[]
						};
						
						_this.data3[editRows] = jp;
					}else if('GERERAL' == dependencyType){//删除的依赖为作业依赖
							for(var it in relJobList){
								var rel = relJobList[it];
								if(cells.relAppCode == rel.relAppCode && cells.relGroupCode == rel.relGroupCode&& cells.relJobCode == rel.relJobCode){
									//删除该行
								}else{
									newjobRelInfoList.push(rel);
								}
							}
								//根据依赖类型，解析作业依赖和事件依赖
								var jx = _this.getRelJsonone(dependencyType,newjobRelInfoList);			
								var jp = {
									'jobCode': editcell.jobCode,//备用字段  actionCode为空（不知原因）
									'actionName':editcell.actionName,
									'groupCode': editcell.groupCode,
									'actionCode':editcell.actionCode,
									'dependencyType':editcell.dependencyType,
									'srcTab': editcell.srcTab,
									'srcTabs':editcell.srcTabs,
									'targetTab': editcell.targetTab,
									'targetTabs':editcell.targetTabs,//目标表列表
									'relJobList': jx.relJobList,//作业依赖列表
									'relGroupCode':jx.relGroups ,
									'relJobCode': jx.relJobs ,
									'relJobName': jx.relJobNames ,
									'eventCode': editcell.eventCode ,
									'eventName': editcell.eventName ,
									'relEventList': editcell.relEventList,
									'joblist3': editcell.joblist3,
									'joblist3op':[{'actionCode':editcell.jobCode,'actionName':editcell.actionName}],
									'jobRelInfoList':editcell.jobRelInfoList ||[]
								};	
								_this.data3[editRows] = jp;
					
					}else if('EVENT' == dependencyType){//删除的依赖为事件依赖
						for(var it in relEventList){
							var rel = relEventList[it];
							if(cells.eventAppCode == rel.eventAppCode && cells.eventCode == rel.eventCode){
									//删除该行
								}else{
									newjobRelInfoList.push(rel);
								}
							}
							var jx = _this.getRelJsonone(dependencyType,newjobRelInfoList);
							var jp = {
								'jobCode': editcell.jobCode,//备用字段  actionCode为空（不知原因）
								'actionName':editcell.actionName,
								'groupCode': editcell.groupCode,
								'actionCode':editcell.actionCode,
								'dependencyType':editcell.dependencyType,
								'srcTab': editcell.srcTab,
								'srcTabs':editcell.srcTabs,
								'targetTab': editcell.targetTab,
								'targetTabs':editcell.targetTabs,//目标表列表
								'relJobList': editcell.relJobList,//作业依赖列表
								'relGroupCode':editcell.relGroupCode ,
								'relJobCode': editcell.relJobCode ,
								'relJobName': editcell.relJobName ,
								'eventCode': jx.relEvents ,
								'eventName': jx.relEventNames ,
								'relEventList': jx.relEventList,
								'joblist3': editcell.joblist3,
								'joblist3op':[{'actionCode':editcell.jobCode,'actionName':editcell.actionName}],
								'jobRelInfoList':editcell.jobRelInfoList ||[]
							};
							
							_this.data3[editRows] = jp;
					}
					_this.$set(_this.data3, editRows, _this.data3[editRows]);
					_this.$nextTick(function(){
						_this.viewRel(jp);			
					});

				},
				setRelAll:function(relList,tableInfos){
					var _this = this;					
					var cells = _this.data3[_this.editDowIndex3];
					var oldsrcTabs = cells.srcTabs;
/* 				    var relJobs = '';//作业依赖字符串
					var relJobNames = '';//作业依赖字符串
				    var relGroups = '';//作业流依赖字符串
				    var relJobList = [];//作业依赖列表
				    var relEvents = '';//事件依赖字符串
				    var relEventNames = '';//事件名称字符串
				    var relEventList = [];//事件依赖列表
					for(var item in relList){
						  var relAppCode = relList[item].relAppCode;//依赖系统
						  var relGroupCode = relList[item].relGroupCode;//依赖作业流
						  var relJobCode = relList[item].relJobCode;//依赖作业
						  var relJobName = relList[item].relJobName;//依赖作业
						  var eventAppCode = relList[item].eventAppCode;//事件系统
						  var eventType = relList[item].eventType;//事件类型
						  var eventCode = relList[item].eventCode;//事件编码
						  var eventName = relList[item].eventName;//事件名称
						  	 if(relJobCode){
						  		 relJobs = relJobs + relJobCode + ';';
						  	 }
							 if(relJobName){
							 	relJobNames = relJobNames + relJobName + ';';
							 }
						  	 if(relGroupCode){
						  		 relGroups = relGroups + relGroupCode+';';
						  	 }
						  	 if(eventCode){
						  		 relEvents = relEvents + eventCode+';';
						  	 }
						  	if(eventName){
						  		 relEventNames = relEventNames + eventName+';';
						  	}
						  	if(relAppCode && relJobCode){
						  		relJobList.push({
						  			'relAppCode':relAppCode,
						  			'relGroupCode':relGroupCode,
									'relJobName':relJobName,
						  			'relJobCode':relJobCode
						  		});
						  	}
						  	if(eventAppCode && eventCode){
						  		relEventList.push({
						  			'eventAppCode':eventAppCode,
						  			'eventCode':eventCode,
						  			'eventName':eventName,
						  			'eventType':eventType
						  		});
						  	}
					}
					_this.data3[_this.editDowIndex3].relJobList = relJobList || [];
					_this.data3[_this.editDowIndex3].relEventList = relEventList || [];
					_this.data3[_this.editDowIndex3].relJobCode = relJobs || '';
					_this.data3[_this.editDowIndex3].relJobName = relJobNames || '';
					_this.data3[_this.editDowIndex3].relGroupCode = relGroups || '';
					_this.data3[_this.editDowIndex3].eventCode = relEvents || '';
					_this.data3[_this.editDowIndex3].eventName = relEventNames || '';
					_this.data3[_this.editDowIndex3].jobRelInfoList = relList || []; */
					
					//_this.data3[_this.editDowIndex3].srcTab = sb; 
					

					
					 /*本批次的作业相互依赖的处理 start*/
					 //1.现将原来的源表依赖其他作业目标的依赖全部删除				  
					 var plusrel = _this.addRelChange('2',oldsrcTabs);//(获取需要减少的依赖)
					 //2.将新的源表依赖其他作业目标的依赖全部增加
					 var addrel = _this.addRelChange('1',tableInfos);//(获取需要减少的依赖)
					 var  lastRel = _this.getLastRel(relList,plusrel,addrel);
					 //根据依赖类型，解析作业依赖和事件依赖
					 var jx = _this.getRelJson(cells.dependencyType,lastRel);
											 
											 
 					var sb = tableInfos.reduce(function(pre,item){
						if(item.tabName){
							return pre + item.tabName+';';	
						}else{
							return pre;
						}
					},'');
					 //*根据解析的结果判断当前源表是否存在依赖 start*/
					 for(var o in tableInfos){
					 	var isexist = 'N';
					 	for(var i in lastRel){
					 		if(tableInfos[o].tabName == lastRel[i].srcTab &&
					 			tableInfos[o].env == lastRel[i].env &&
					 			tableInfos[o].schema == lastRel[i].schema){
					 				if( lastRel[i].relJobCode || lastRel[i].eventCode){//依赖作业和事件存在一个即使存在依赖关系
					 					isexist = 'Y';
					 					break;
					 				}	
					 		}				
					 	}
					 	if(isexist == 'Y'){
					 		tableInfos[o].existsFlag = 'Y';					
					 	}else{
					 		tableInfos[o].existsFlag = 'N';
					 	}
					 }
					// _this.data3[_this.editDowIndex3].srcTabs = tableInfos;
					 /*根据解析的结果判断当前源表是否存在依赖 end*/
											 
											 
					 var jp = {
					 	'jobCode': cells.jobCode,//备用字段  actionCode为空（不知原因）
					 	'actionName':cells.actionName,
					 	'groupCode': cells.groupCode,
					 	'actionCode':cells.actionCode,
					 	'dependencyType':cells.dependencyType,
					 	'srcTab': sb,
					 	'srcTabs':tableInfos,
					 	'targetTab': cells.targetTab,
					 	'targetTabs':cells.targetTabs,//目标表列表
					 	'relJobList': jx.relJobList,//作业依赖列表
					 	'relGroupCode':jx.relGroups ,
					 	'relJobCode': jx.relJobs ,
					 	'relJobName': jx.relJobNames ,
					 	'eventCode': jx.relEvents ,
					 	'eventName': jx.relEventNames ,
					 	'relEventList': jx.relEventList,
					 	'joblist3': cells.joblist3,
						'joblist3op':[{'actionCode':cells.jobCode,'actionName':cells.actionName}],
					 	'jobRelInfoList':lastRel ||[]
					 }; 
					 _this.data3[_this.editDowIndex3] = jp;
					 _this.$set(_this.data3, _this.editDowIndex3, _this.data3[_this.editDowIndex3]);
					 _this.$nextTick(function(){
						_this.showSrcTabDialog = false;					 
					 });
				},
				/*修改目标表 start*/
				showTarTab: function (cellone){ //显示源表的弹出框
				
					var _this = this;
					setTimeout(function(){
						_this.showSrcTarDialog = true;
						_this.srcTarData = [];
						_this.$nextTick(function(){
							 //拿到目标表的信息展示
							var sq = cellone.targetTabs ||[];
							var ms = [];
							for(var ii in sq){
								ms.push({'tabName':sq[ii].tabName,'env':sq[ii].env,'schema':sq[ii].schema,isAdd:false,existsFlag:''});	
							}
							_this.srcTarData = ms;
						})
						
					},200);
					
					
				},
				addTartab:function(){//新增
					//根据作业流获取源表其他值
					this.srcTarData.push({'tabName':'','env':'','schema':'',isAdd:true,existsFlag:''});
	/* 				var cell = this.data3[this.editDowIndex3];
					//1.根据作业流和作业区第二部找作业类型
					var s2 = this.data2 ||[];
					var jobTypeCode = '';
					for(var i in s2){
						if(cell.groupCode == s2[i].groupCode && cell.jobCode == s2[i].actionCode){
							  jobTypeCode = s2[i].jobTypeCode;
							  break;
						}
					}
					if(jobTypeCode){
						var srccell = this.getEnv(jobTypeCode);
						this.srcTarData.push({'tabName':'','env':srccell.env,'schema':srccell.schema,isAdd:true,existFlag:''});
					}else{
						this.$message({
							message: '其他类型的解析器无法新增目标表！',
							type: 'warning'
						});
						return;
					} */
				},
				deleteTartab:function(idx,cell){//删除
				
					this.srcTarData.splice(idx,1);
				},
				cancelSrcTar:function(){//取消
					this.showSrcTarDialog = false;
				},
				saveSrcTar:function(){//保存目标表
					var oldTar = this.data3[this.editDowIndex3].targetTabs;
					var tar = this.srcTarData ||[];
					var sb = tar.reduce(function(pre,item){
						if(item.tabName){
							return pre + item.tabName+';';	
						}else{
							return pre;
						}
					},'');
					this.data3[this.editDowIndex3].targetTabs = this.srcTarData;
					this.data3[this.editDowIndex3].targetTab = sb;
					
					//在依赖当前目标表的作业中删除当前作业依赖
					this.changeTargetRel(oldTar,tar);
					this.$set(this.data3, this.editDowIndex3, this.data3[this.editDowIndex3]);
					this.showSrcTarDialog = false;
				},
				tableSelect:function(sel){
					this.data2Sel = sel || [];
				},
				tableSelect2:function(sel){
					this.data3Sel = sel || [];
				},
				/*修改目标表 end*/
				copystep2:function(){//第二步复制
				var _this = this;
				let selectDatas = this.data2Sel || [];
					if(selectDatas.length >0){
							var oldarr = _this.data2;
							_this.data2 = [];
							var addsel = [];

								for(var item in selectDatas ){
									var workBaseFormData = {};; //作业基本信息
									var workExecFormData = {};; //作业基本信息
									var workAdditionalFormData = {};; //作业基本信息
									yufp.clone(selectDatas[item].workBaseFormData,workBaseFormData);
									//var workExecFormData = selectDatas[item].workExecFormData;
									yufp.clone(selectDatas[item].workExecFormData,workExecFormData);
									yufp.clone(selectDatas[item].workAdditionalFormData,workAdditionalFormData);
									//var workAdditionalFormData = selectDatas[item].workAdditionalFormData; //作业附件限制
									workExecFormData.useEventCrossList = []; // 复制作业时，不复制事件依赖
									addsel.push({
										'agentCode':selectDatas[item].agentCode || '',
										'groupCode': selectDatas[item].groupCode||'',
										'groupName': selectDatas[item].groupName ||'',
										'actionName': selectDatas[item].actionName ||'',
										'actionCode': _this.getUID() ||'',
										'jobTypeCode':selectDatas[item].jobTypeCode || '',
										'actionExec': selectDatas[item].actionExec ||'',
										'startFlag': selectDatas[item].startFlag ||'0',
										'isOld': false,
										workBaseFormData,
										workExecFormData,
										workAdditionalFormData
									});	
								}
								oldarr = oldarr.concat(addsel);
								_this.data2 = oldarr;						
								
					}else{
						this.$message({
							message: '请至少选择一条进行复制！',
							type: 'warning'
						});
						return;
					}

					
				},
				copystep3:function(){//第三步复制
					var _this = this;
					let selectDatas = _this.data3Sel || [];
					if(selectDatas.length >0){
							for(var item in selectDatas ){
								_this.data3.push({
										'groupCode': selectDatas[item].groupCode,
										'actionCode': selectDatas[item].actionCode,
										'jobCode': selectDatas[item].jobCode,
										'actionName':selectDatas[item].actionName,
										'dependencyType':selectDatas[item].dependencyType,
										'srcTab': selectDatas[item].srcTab,
										'srcTabs':selectDatas[item].srcTabs,
										'targetTab':selectDatas[item].targetTab,
										'targetTabs':selectDatas[item].targetTabs,
										'relJobList': selectDatas[item].relJobList,
										'relGroupCode':selectDatas[item].relGroupCode,
										'relJobCode': selectDatas[item].relJobCode,
										'relJobName': selectDatas[item].relJobName,
										'eventCode': selectDatas[item].eventCode,
										'eventName': selectDatas[item].eventName,
										'relEventList': selectDatas[item].relEventList,
										'joblist3op':[{'actionCode':selectDatas[item].jobCode,'actionName':selectDatas[item].actionName}],
										'joblist3': selectDatas[item].joblist3
									});	
							}
					}else{
						this.$message({
							message: '请至少选择一条进行复制！',
							type: 'warning'
						});
						return;
					}
				},
				getEventData :function(){
					var parseList = [];
					var html = event.clipboardData.getData('text/html');
					var $doc = new DOMParser().parseFromString(html,'text/html');
					var $trs = Array.from($doc.querySelectorAll('table tr'));
					for(var item in $trs){
						var line = [];
						var tdlist = $trs[item].querySelectorAll('td');//nodelist类型
						var tdlistarr = [];//nodelist 转数组
						for(var i =0;i<tdlist.length;i++){
							tdlistarr.push(tdlist[i]);
						}
						for(var i =0;i<tdlistarr.length;i++){//数组获取内容
							line.push(tdlistarr[i].innerText);
						}
						parseList.push(line);
					}
					return parseList;
				},
				addParse: function (){ //粘贴事件
					var _this = this;	
					document.addEventListener('paste',function(ent){
						//作业第二部的复制
						if(_this.active == 2  && _this.dialogVisible && !_this.jobdisabled){
							 var parseList = _this.getEventData(); 
							_this.addJob2Parse(parseList);
						}	
						
						//作业第三部的复制
						if(_this.active == 3  && _this.dialogVisible && !_this.jobdisabled){
							 var parseList = _this.getEventData(); 
							_this.addJob3Parse(parseList);
						}	
							
						//作业流excel复制
						if(_this.activeflex == 2  && _this.dialogVisibleflex && !_this.flowdisabled){
							var parseList = _this.getEventData(); 
							_this.addJob2Parseflex(parseList);	
						}	
							
					});
					
					
				},
				getTaskInfo(appCode, groupCode) { //根据系统编码和作业流编码查询调度任务信息
					var _this = this;
					var josn = {
						'appCode': appCode,
						'groupCode': groupCode
					};
					yufp.service.request({
						method: 'GET',
						async: false,
						url: '/api/use/plats/taskSchedule/queryDetail',
						data: josn,
						callback: function(code, message, response) {
							if (response && response.code == 0) {
								if (response.data) {
									taskft = { //新增的默认数据
									    offSet:response.data.offSet || '', //偏移量
										taskId: response.data.taskId || '', //任务id
										taskName: response.data.taskName || '', //任务
										cycleTime: response.data.cycleTime || '', //周期时点
										calendarCode: response.data.calendarCode || '', //工作日历
										effectDate: response.data.effectDate || '', //生效日期
										expireDate: response.data.expireDate || '', //失效日期,
										validFlag: response.data.validFlag || 'Y', //任务状态
										triggerNm: response.data.triggerNm || '', //任务触发器名称
										triggerId: response.data.triggerId || '', //任务触发器id
										InSideFlag: response.data.InSideFlag || 'N', //使用内置时点
										insideCycleTime: response.data.insideCycleTime || '', //内置时点
										remark: response.data.remark || '', //备注
										paramDatas: response.data.useTaskParamList || [] //任务参数
									}

								} else { //没有任务，选择默认
									taskft = { //新增的默认数据
										taskId: '', //任务id
										taskName: '', //任务
										cycleTime: '', //周期时点
										calendarCode: '', //工作日历
										effectDate: _this.getDay(), //生效日期
										expireDate: '', //失效日期,
										validFlag: 'Y', //任务状态
										triggerNm: '', //任务触发器
										triggerId: '', //任务触发器id
										InSideFlag: 'N', //使用内置时点
										insideCycleTime: '', //内置时点
										remark: '', //备注
										paramDatas: [] //任务参数
									}

								}
							} else {
								_this.$message({
									message: response.message,
									type: 'warning'
								});
								return;
							}
						},
					});
				},
				jobChange:function(event,cell){ 
					var _this= this;
					code = cell.jobCode;
					if(event){ //展开前如果为空，则获取作业列表
						if(cell.groupCode){
							 _this.data3[cell.index].joblist3op = _this.getJoblist3(cell.groupCode);
						}
						thisRow = cell.index;
						thisval = code;
						return; //下拉框展开不触发改变事件
					}else{
						_this.data3[cell.index].joblist3op = [];
					}
					//根据编码获取名称
					var actionName = _this.getName(cell.jobCode,cell.joblist3)
					_this.data3[cell.index].actionName = actionName;
					 _this.resetRef();//重置依赖
					//1.修改作业的时候判断作业和依赖是否一样
/* 					if (cell.actionCode == _this.data3[_this.editDowIndex3].relJobCode && cell.actionCode) {
						_this.$message({
							message: '作业和依赖作业不能相同！',
							type: 'warning'
						});
						return;
					}
					
					//2.修改作业时候判断作业和依赖作业的作业流是否一致，一致不需要触发器
					if (_this.data3[_this.editDowIndex3].groupCode == _this.data3[_this.editDowIndex3].relGroupCode && _this.data3[_this.editDowIndex3].relGroupCode) {
							_this.data3[_this.editDowIndex3].eventOnly = true;
							_this.data3[_this.editDowIndex3].eventCode = '';
							_this.data3[_this.editDowIndex3].eventName = '';
							_this.data3[_this.editDowIndex3].eventType = '';
							_this.data3[_this.editDowIndex3].eventAppCode = '';			
					}else{
						_this.data3[_this.editDowIndex3].eventOnly = false;
					} */
					
					
					
				},
				showEvent: function(flag) {
					var _this = this;	
					setTimeout(function(){
						var selarr = _this.data3[_this.editDowIndex3];
						if (!selarr.jobCode || !selarr.groupCode) {
							_this.$message({
								message: '请先选择作业流和作业!',
								type: 'warning'
							});
							return;
						}
						var  spl = _this.data3[_this.editDowIndex3].relEventList || [];
						_this.EventShowData = spl;
						_this.$nextTick(function(){
							_this.reEventShow = true;	
						});							
					},200);

				},
				addParams: function() {

					var _this = this;
					var obj = {
						paramCode: '',
						paramName: '',
						paramValue: '',
						remark: ""
					};
					_this.paramDatas.push(obj);

				},
				getDay: function() { //生成当前日期
					var dt = new Date();
					var y = dt.getFullYear();
					var m = dt.getMonth() + 1;
					var d = dt.getDate();
					if (Number(m) < 10) {
						m = '0' + m;
					}
					if (Number(d) < 10) {
						d = '0' + d;
					}

					return y + m + d;
				},
				deleteParams: function() {
					var _this = this;
					let selectDatas = _this.$refs.refparamstab.selections;
					for (let jdx = _this.paramDatas.length - 1; jdx >= 0; jdx--) {
						for (let idx = 0; selectDatas.length > idx; idx++) {
							if (_this.paramDatas[jdx] == selectDatas[idx]) {
								_this.paramDatas.splice(jdx, 1);
								break;
							}
						}

					}
				},
				// 使用内置时点选择处理
				changeInSide: function(event) {//opval	 //formDataTask.InSideFlag;
					var _this = this;
					var code = _this.formDataTask.InSideFlag;
					if(event){
						opval = code;
						return; //下拉框展开不触发改变事件
					}
					//下拉框关闭事件
					if(opval == code){ //前后一样不改变
						return;
					}
					
					var value =code ||'';
					if (value === 'Y') {
						//this.showInsideCycleTime = true;
						if (_this.showConfim) {
							_this.$confirm('若设置内置时点,则周期时点等于内置时点时任务才运行,且任务运行完成后自动步进内置时点', '提示', {
								confirmButtonText: '确定',
								cancelButtonText: '取消',
								type: 'warning',
								center: true,
								callback: function(action) {
									if (action === 'confirm') {
										_this.showInsideCycleTime = true;
									} else {
										_this.InSideFlag = "N";
									}
								}
							});
						} else {
							_this.showConfim = true;
							_this.showInsideCycleTime = true;
						}
					} else {
						_this.showConfim = true;
						_this.showInsideCycleTime = false;
						if (_this.formDataTask.insideCycleTime) {
							_this.formDataTask.insideCycleTime = "";
						}
					}
				},

				// 触发器选择页面打开
				selectTrigger: function() {
					var _this = this;
					_this.chooseTriggerDialogVisible = true;
					_this.$nextTick(function() {
						let model = {};
						var param = {
							condition: JSON.stringify(model)
						};
						_this.$refs.triggerTableRef.remoteData(param);
					});
				},
				// 触发器选择动作
				selectTriggerValue: function() {
					var _this_ = this;
					if (_this_.$refs.triggerTableRef.selections.length != 1) {
						_this_.$message('请先选择一条数据');
						return;
					}

					_this_.data2flex[_this_.editDowIndexflex].formDataTask.triggerNm = _this_.$refs.triggerTableRef.selections[0]
						.timerName;
					_this_.data2flex[_this_.editDowIndexflex].formDataTask.triggerId = _this_.$refs.triggerTableRef.selections[0]
						.timerCode;
					/* 					_this_.formDataTask.triggerNm = _this_.$refs.triggerTableRef.selections[0].timerName;
										_this_.formDataTask.triggerId = _this_.$refs.triggerTableRef.selections[0].timerCode; */
					_this_.chooseTriggerDialogVisible = false;
				},
				selectCycleTime: function() {
					var _this = this;
					_this.chooseCommonParamDialogVisible = true;
					_this.$nextTick(function() {
						let model = {};
						if (_this.addFlag) {
							model.appCode = _this.currentClickNode.appCode;
						} else {
							model.appCode = _this.$refs.refTable.selections[0].appCode;
						}

						var param = {
							condition: JSON.stringify(model)
						};
						_this.$refs.commParamTableRef.remoteData(param);

					});
				},
				selectCommParamValue: function() {
					var _this = this;
					if (_this.$refs.commParamTableRef.selections.length != 1) {
						_this.$message('请先选择一条数据');
						return;
					}

					_this.formDataTask.cycleTime = "{#" + _this.$refs.commParamTableRef.selections[0].paramCode + "#}";

					_this.chooseCommonParamDialogVisible = false;
				},
				changeGroup: function(vals, vname) { //选择调度任务流后自动带出任务名称
					if (vname !== '') {
						this.formDataTask.taskName = vname;
					}
				},
				//作业流高级信息的弹框
				moreallflex: function(cell) { //展示高级页面
					var _this = this;
					_this.taskDialog = true;
					//this.$refs.refFormTask.resetFields();
					_this.$nextTick(function() {
						_this.paramDatas = cell.formDataTask.paramDatas;
						cell.formDataTask.effectDate = _this.formatStrToDate(cell.formDataTask.effectDate);
						cell.formDataTask.expireDate = _this.formatStrToDate(cell.formDataTask.expireDate);
						cell.formDataTask.insideCycleTime = _this.formatStrToDate(cell.formDataTask.insideCycleTime);
					//	yufp.clone(cell.formDataTask, _this.formDataTask); //基本信息

							_this.formDataTask.taskId= cell.formDataTask.taskId || ''; //任务id
							_this.formDataTask.taskName=cell.formDataTask.taskName || ''; //任务
							_this.formDataTask.cycleTime= cell.formDataTask.cycleTime || ''; //周期时点
							_this.formDataTask.calendarCode= cell.formDataTask.calendarCode || ''; //工作日历
							_this.formDataTask.effectDate=cell.formDataTask.effectDate || ''; //生效日期
							_this.formDataTask.expireDate= cell.formDataTask.expireDate || ''; //失效日期,
							_this.formDataTask.validFlag=cell.formDataTask.validFlag || ''; //任务状态
							_this.formDataTask.triggerNm= cell.formDataTask.triggerNm || ''; //任务触发器
							_this.formDataTask.triggerId= cell.formDataTask.triggerId || ''; //任务触发器id
							_this.formDataTask.InSideFlag= cell.formDataTask.InSideFlag || ''; //使用内置时点
							_this.formDataTask.insideCycleTime= cell.formDataTask.insideCycleTime || ''; //内置时点
							_this.formDataTask.remark= cell.formDataTask.remark || ''; //备注
							
							if('Y' == _this.formDataTask.InSideFlag){
								_this.showInsideCycleTime = true;
							}else{
								_this.showInsideCycleTime = false;								
							} 
							

						
						
				
						
						
						_this.activeTabName = "taskInfo";
						_this.nodeTemp.appCode = _this.searchFormdata.appCode;
						_this.setInitrelDataList(_this.searchFormdata.appCode, 'add', {}); //初始化日历			
					})

				},
				formatStrToDate: function(strDate) {
					/* 					if (strDate != null && strDate.length == 8) {
									
											var year = parseInt(strDate.substring(0, 4));
											var month = parseInt(strDate.substring(4, 6));
											var day = parseInt(strDate.substring(6, 8));
											return new Date(year, month - 1, day);
									
										} else {
											return null;
										} */
					return strDate.trim();
				},
				setInitrelDataList: function(appCode, operate, currentData) {
					var _this = this;
					var paramObj = {};
					paramObj.appCode = appCode;

					yufp.service.request({
						method: 'GET',
						url: _this.queryRefDataList,
						data: paramObj,
						async: false,
						callback: function(code, message, response) {
							if (response.code != 0) {
								_this.$message(response.message);
							} else {
								//_this.paramDatas.splice(0);
								_this.calendarCodeOptions.splice(0);
								_this.triggerOptions.splice(0);
								_this.groupCodeOptions.splice(0);

								for (let i = 0; i < response.data.triggerList.length; i++) {
									_this.triggerOptions.push({
										key: response.data.triggerList[i].timerCode,
										value: response.data.triggerList[i].timerName
									});
								}

								for (let i = 0; i < response.data.calendarList.length; i++) {
									_this.calendarCodeOptions.push({
										key: response.data.calendarList[i].calendarCode,
										value: response.data.calendarList[i].calendarName
									});
								}

								for (let i = 0; i < response.data.wftGrpList.length; i++) {
									_this.groupCodeOptions.push({
										key: response.data.wftGrpList[i].groupCode,
										value: response.data.wftGrpList[i].groupName
									});
								}

							}
						}
					});
				},
				cancelFnTask: function() {
					var _this = this;
					_this.taskDialog = false;
				},
				nextStepTask: function() {
					var _this = this;
					var validate = false;
					_this.$refs.refFormTask.validate(function(valid) {
						validate = valid;
					});
					if (!validate) {
						return;
					} else {
						if (_this.formDataTask.effectDate != null) {
							if (_this.formDataTask.expireDate != null) {
								if ((new Date(_this.formDataTask.effectDate).getTime()) > (new Date(_this.formDataTask.expireDate).getTime())) {
									_this.$message({
										message: "生效日期不能大于失效日期",
										type: "warning"
									});
									return;
								}
							}

						}
						this.activeTabName = "taskParam";
					}
				},
				lastStepTask: function() {
					this.activeTabName = "taskInfo";
				},
				saveFnTask: function() {
					var _this = this;
					var validate = false;
					_this.$refs.refFormTask.validate(function(valid) {
						validate = valid;
					});
					if (!validate) {
						return;
					}
					var paramObj = _this.formDataTask;
					// 结束时间处理
					if (paramObj.expireDate == null) {
						paramObj.expireDate = ' ';
					}
					var vidiArr = [];
					if (_this.paramDatas.length > 0) {
						for (let i = 0; i < _this.paramDatas.length; i++) {
							if (_this.paramDatas[i].paramCode == null || _this.paramDatas[i].paramCode.trim() == "" ||
								_this.paramDatas[i].paramName == null || _this.paramDatas[i].paramName.trim() == "" ||
								_this.paramDatas[i].paramValue == null || _this.paramDatas[i].paramValue.trim() == "") {
								_this.$message({
									message: "参数代码，参数名称，参数值均不能为空",
									type: "warning"
								});
								return;
							}else{
								//判断该参数作业代码是否存在
								var lg = false;
								for(var j in vidiArr){
									  if(_this.paramDatas[i].paramCode == vidiArr[j].paramCode){
										  lg = true;
										  _this.$message({
										  	message: "第"+(Number(i) + 1)+"行的参数代码重复!",
										  	type: "warning"
										  });			  
									  }	
								}
								if(lg){
									return;
								}else{
									vidiArr.push(_this.paramDatas[i]);
								}
								
							}
							
							
						}
						paramObj.useTaskParamList = _this.paramDatas;
					}
					_this.data2flex[_this.editDowIndexflex].formDataTask = {
						taskId: _this.formDataTask.taskId || '', //任务id
						taskName: _this.formDataTask.taskName || '', //任务
						cycleTime: _this.formDataTask.cycleTime || '', //周期时点
						calendarCode: _this.formDataTask.calendarCode || '', //工作日历
						effectDate: _this.formDataTask.effectDate || '', //生效日期
						expireDate: _this.formDataTask.expireDate || '', //失效日期,
						validFlag: _this.formDataTask.validFlag || 'Y', //任务状态
						triggerNm: _this.formDataTask.triggerNm || '', //任务触发器
						triggerId: _this.formDataTask.triggerId || '', //任务触发器id
						InSideFlag: _this.formDataTask.InSideFlag || 'N', //使用内置时点
						insideCycleTime: _this.formDataTask.insideCycleTime || '', //内置时点
						remark: _this.formDataTask.remark || '', //备注
						paramDatas: _this.paramDatas || [] //任务参数	
					}
					_this.taskDialog = false;
				},
				setOldFlow: function() { //引入所依赖的作业
					var _this = this;
					if (_this.active == 2) {
						_this.visibleFlow = true;
							var searchData = {}; 
							searchData.appCode = _this.searchFormdata.appCode; //系统编码	  
						_this.$nextTick(function() {
								var param = {
									condition: JSON.stringify(searchData)
								};
								_this.$refs.jobTableRef.remoteData(param);
						
						})			
						
					} else {
						setTimeout(function() { //设置一个200毫秒的延迟，让该事件能先选中当前行
							//判断输入作业流和作业	
							var selarr = _this.data3[_this.editDowIndex3];
							if (!selarr.jobCode || !selarr.groupCode) {
								_this.$message({
									message: '请先选择作业流和作业!',
									type: 'warning'
								});
								return;
							}
							//将当前行的数据给
							var  spl = _this.data3[_this.editDowIndex3].relJobList || [];
							_this.JobShowData = spl;
							_this.$nextTick(function(){
								_this.relJobShow = true;
									
							});
/* 							var searchData = {}; 
							var param = {
								condition: JSON.stringify(searchData)
							};
							_this.$nextTick(function(){
							 _this.$refs.jobTableRefFlag.remoteData(param);
							});*/
						}, 200) 
					}
					
					

	
				},
				setOldFlowflex: function() { //引入所依赖的作业流
					var _this = this;
					_this.baseGroupParams.condition = JSON.stringify({
						appCode: _this.searchFormdata.appCode
					})
					_this.visibleFlowflex = true;
					var searchData = {};
					searchData.appCode = _this.searchFormdata.appCode; //系统编码
					var param = {
						condition: JSON.stringify(searchData)
					};
					_this.$nextTick(function() {
						_this.$refs.jobTableRefflex.remoteData(param);
					})
				},
				cancelC: function() {
					this.showContent = false;
				},
				addContent: function(datac) { //显示执行内容的弹出框

					var _this = this;
					setTimeout(function() { //设置一个200毫秒的延迟，让该事件能先选中当前行
						_this.showContent = true;
						_this.$nextTick(function() {
							_this.sqlc.content = datac.target ? datac.target.value : '';
						})
					}, 200)

				},
				confirmC: function() { //确定
					this.data2[this.editDowIndex].actionExec = this.sqlc.content;
					this.showContent = false;
				},
				jobGuideFn: function() { //作业向导
					var _this = this;
					this.editflag = 'add';
					this.dialogVisible = true;
					this.jobdisabled = false;
					this.clearAllFlex();
					//获取作业类型定义
					this.getJobList();
					this.$nextTick(function(){
						_this.getGroupCodeList(_this.searchFormdata.appCode);
						
					})
					
				},
				jobFlowGuideFn: function() { //作业流向导+
					this.editflag = 'add';
					this.flowdisabled = false;
					this.dialogVisibleflex = true;
					//清空
					this.clearAllFlex();
				},
				successUpload: function(response, file, fileList) { //导入成功后执行
					const _this = this;
					//  const param = {};
					_this.excelloading = true;
					//  param.excelUpLoadFile = response.data;
					yufp.service.request({
						method: 'POST',
						url: '/api/use/citiccard/jobconf/import',
						data: response.data,
						callback: function(code, message, response) {
							_this.excelloading = false;
							if (response.code == 0) {
								_this.$refs['my-upload'].clearFiles();
								_this.upLoadDialogVisible = false;
								//导入成功后，将导入的结果展示在页面
								_this.viewConfOnly(response.data)
							} else {
								_this.upLoadDialogVisible = false;
								_this.$message('导入失败!');
							}
						}
					});
				},
				importCfgFn: function() { //导入配置
					//先展示作业流，全部不可编辑
					var _this = this;

					_this.upLoadDialogVisible = true;
				},
				exportCfgFn: function() { //导出配置
					var _this = this;
					let selectDatas = _this.$refs.refTable.selections;
					if (selectDatas && selectDatas.length > 0) {
						var versionNo = selectDatas[0].versionNo;
						var json = {
							'versionNo': versionNo
						}
						yufp.util.download("api/use/citiccard/jobconf/export?versionNo=" + versionNo);
					} else {
						this.$message({
							message: '请选择一条导出的数据!',
							type: 'warning'
						});
					}
				},
				importJobList:function(tsdata){//根据作业列表解析作业流和作业列表，主要作用：知道id，选中下拉框名称
					var grouplist = [];
					var joblist = [];
					if( tsdata && tsdata.length > 0){
						  for(var item in tsdata){
							   joblist.push({'actionCode':tsdata[item].actionCode,'actionName':tsdata[item].actionName});
						  }
					}
					this.importJoblist = joblist;
				},
				viewConfOnly: function(view) {//导入确认
					var _this = this;
					let type = view.confType;
					_this.editflag = 'view';
					_this.cover = view.cover || 'N';
					if (type == 'job') { //展示作业配置页面，切不可编辑
						_this.dialogVisible = true;
						_this.jobdisabled = true;
						//导入确认
						_this.$nextTick(function() {
							_this.active = 1;
							_this.searchFormdata.appCode = view.appCode;
							_this.formdata1.versionNo = view.versionNo;
							_this.formdata1.versionRemark = view.versionRemark;
							var jobExts = view.jobExts || []; //第二部的数据
							/*根据数据解析出作业流的下拉框的作业的下拉框*/
							_this.importJobList(jobExts);
							var jobRelInfos = view.jobRelInfos || []; //第三部的数据
							//解析第二部的数据
							var dependencyPos = _this.postData2(jobExts);//解析第二步的数据同时拿到第三步的数据
							//解析第三部的数据
							_this.postData3(dependencyPos); //第三部的数据点击下一步获取
						})
					} else { //展示作业流配置页面
						_this.flowdisabled = true;
						_this.dialogVisibleflex = true;
						_this.$nextTick(function() {
							_this.activeflex = 1;
							_this.searchFormdata.appCode = view.appCode;
							_this.formdata1flex.versionNo = view.versionNo;
							_this.formdata1flex.versionRemark = view.versionRemark;
							//解析第二部数据
							var jobFlowRels = view.jobFlowRels || [];
							_this.postFlexData2(jobFlowRels);


						});
					}

				},
				postFlexData2: function(jobExts) {
					var arr = [];
					for (var item in jobExts) {
						var ob = jobExts[item];
						var formDataTask = { //新增的默认数据
							taskId: ob.taskId || '', //任务id
							taskName: ob.taskName || '', //任务
							cycleTime: ob.cycleTime || '', //周期时点
							calendarCode: ob.calendarCode || '', //工作日历
							effectDate: ob.effectDate || this.getDay(), //生效日期
							expireDate: ob.expireDate || '', //失效日期,
							validFlag: ob.validFlag || 'Y', //任务状态
							triggerNm: ob.triggerNm || '', //任务触发器
							triggerId: ob.triggerId || '', //任务触发器id
							InSideFlag: ob.insideCycleTime ? 'Y':'N', //使用内置时点
							insideCycleTime: ob.insideCycleTime || '', //内置时点
							remark: ob.remark || '', //备注
							useTaskTimer:ob.useTaskTimer || {},
							paramDatas: ob.useTaskParamList || [] //任务参数
						}
						var jsone = {
							'groupCode': ob.groupCode || '',
							'groupName': ob.groupName || '',
							'time1': '',
							'offSet': ob.offSet || '',
							'startFlag': '0',
							'isOld': true,
							'formDataTask': formDataTask
						};

						arr.push(jsone);
					}
					this.data2flex = arr || [];
				},
				updateFn: function() { //修改
					var _this = this;
					let selectDatas = _this.$refs.refTable.selections;
					if (selectDatas && selectDatas.length > 0) {
						if (selectDatas[0].opType == 'IMPORT') {
							this.$message({
								message: '本行数据已导入，无法修改!',
								type: 'warning'
							});
							return;
						}
						var versionNo = selectDatas[0].versionNo;
						var json = {
							'versionNo': versionNo
						}
						if(selectDatas[0].confType == 'job'){
							//获取作业类型定义
							_this.getJobList();						
						}
						yufp.service.request({
							method: 'GET',
							url: '/api/use/citiccard/jobconf/queryJobConf',
							data: json,
							callback: function(code, message, response) {
								if (response && response.code == 0) {
									//处理数据，将得到的数据.
									_this.setUpdateData(response.data);

								} else {
									_this.$message({
										message: response.message,
										type: 'warning'
									});
									return;
								}
							},
						});
					} else {
						this.$message({
							message: '请选择一条数据!',
							type: 'warning'
						});
					}
				},
				setUpdateData: function(datax) {
					var _this = this;
					_this.editflag = 'edit';
					if (datax.confType == 'job') { //作业的编辑
						_this.jobdisabled = false;
						_this.dialogVisible = true;
						_this.$nextTick(function() {
							_this.active = 1;
							_this.searchFormdata.appCode = datax.appCode;
							//初始化公共参数
							_this.initBaseParams(datax.appCode);
							//获取集群代理名称列表
							_this.queryWftAgtList(datax.appCode);
							//根据系统名称获取作业流列表
							_this.getGroupCodeList(datax.appCode)
							_this.formdata1.versionNo = datax.versionNo;
							_this.formdata1.versionRemark = datax.versionRemark;
							var jobExts = datax.jobExts || []; //第二部的数据
							var jobRelInfos = datax.jobRelInfos || []; //第三部的数据
							//解析第二部的数据
							_this.postData2(jobExts);
							//解析第三部的数据
							//_this.postData3(jobRelInfos); //第三部的数据点击下一步获取
						})
						//1.2第二部参数
						/* var jobExts =  _this.getStep2Data();//组装的第二部参数
						 //1.2.1 组装第二部高级信息参数
						 //第三部的数据
						 var jobRelInfos = _this.getData3(); */


					} else if (datax.confType == 'flow') { //作业流编辑
						_this.flowdisabled = false;
						_this.dialogVisibleflex = true;
						_this.$nextTick(function() {
							_this.activeflex = 1;
							_this.searchFormdata.appCode = datax.appCode;
							_this.formdata1flex.versionNo = datax.versionNo;
							_this.formdata1flex.versionRemark = datax.versionRemark;
							//解析第二部数据
							var jobFlowRels = datax.jobFlowRels || [];
							_this.postFlexData2(jobFlowRels);
						})
					} else {
						_this.$message({
							message: '未知的数据类型！',
							type: 'warning'
						});
					}
				},
				postData2: function(jobExts) { //解析第二步的数据
					var _this = this;
					var data2old = [];
					var dependencyPos = [];
					if (jobExts && jobExts.length > 0) {
						for (var item in jobExts) {
							var ob = jobExts[item];
							dependencyPos = dependencyPos.concat(ob.dependencyPos);
							var workBaseFormData = {
								typeCode:ob.typeCode ||'C',
								success: ob.success,
								actionPrior: ob.actionPrior,
								maxRetry: ob.maxRetry,
								multiFlag: ob.multiFlag,
								intrFlag: ob.intrFlag,
								condType: ob.condType,
								remark: ob.remark
							}; //作业基本信息		
							var workExecFormData = {
								'wftParList': ob.wftParList || [],
								'useEventCrossList': ob.useEventCrossList || []
							};
							var limitBegin = ob.limitBegin || '';
							var limitEnd = ob.limitEnd || '';
							var limitInfo = ob.limitInfo || '';
							var timepicker = [];
							var timeList = [];
							if (limitBegin && limitEnd) {
								timepicker.push(new Date(2020, 5, 29, limitBegin.substring(0, 2), limitBegin.substring(2, 4), limitBegin.substring(
									4, 6)));
								timepicker.push(new Date(2020, 5, 29, limitEnd.substring(0, 2), limitEnd.substring(2, 4), limitEnd.substring(
									4, 6)));
							}
							var i = 0;
							var timeList = [];
							while (limitInfo && i < limitInfo.trim().length) {

								if ((limitInfo.slice(i, i + 4)).indexOf('@DT') > -1) {
									var value = '';
									for (var j in _this.dateTypeOptions) {
										if (_this.dateTypeOptions[j].key == (limitInfo.slice(i, i + 4)).split('@DT')[1]) {
											value = _this.dateTypeOptions[j].value;
											break;
										}
									}
									timeList.push({
										key: limitInfo.slice(i, i + 4),
										value: value
									});
								} else if ((/^[0-9]+$/.test(limitInfo.slice(i, i + 4)))) {
									timeList.push({
										key: limitInfo.slice(i, i + 4),
										value: limitInfo.slice(i, i + 4).slice(0, 2) + '月' + limitInfo.slice(i, i + 4).slice(2, 4) + '日'
									});
								} else {
									timeList.push({
										key: limitInfo.slice(i, i + 4),
										value: yufp.lookup.convertKey('USE_FIXED_TIME_RANGE', limitInfo.slice(i, i + 4).slice(0, 1)) + yufp.lookup
											.convertKey('USE_FIXED_TIME_F', limitInfo.slice(i, i + 4).slice(1, 2)) + limitInfo.slice(i, i + 4).slice(
												2, 4) + '天'
									});
								}
								i = i + 4;
							}
							var workAdditionalFormData = {
								timepicker: timepicker || [],
								timeList: timeList ||[]
							}; //作业附件限制
							var jone = {
								'agentCode': ob.agentCode || '',
								'groupCode': ob.groupCode || '',
								'groupName': ob.groupName || '',
								'actionName': ob.actionName || '',
								'actionCode': ob.actionCode || '',
								'jobTypeCode': ob.parseCode || '', //作业定义类型编码(待确定)
								'actionExec': ob.actionExec || '',
								'startFlag': '0',
								'isOld': true,
								workBaseFormData,
								workExecFormData,
								workAdditionalFormData
							}
							data2old.push(jone);

						}


					}
					_this.data2 = data2old || [];
					return dependencyPos;
				},
				postData3: function(dependencyPos) { //解析第三部的数据
					var _this = this;
					var data3Rel = [];
					if (dependencyPos && dependencyPos.length > 0) {
						for (var item in dependencyPos) {
							var ob = dependencyPos[item];

							var jx = _this.getRelJson(ob.dependencyType,ob.jobRelInfoList);						
							var jp = {
								'jobCode': ob.jobCode,//备用字段  actionCode为空（不知原因）
								'groupCode': ob.groupCode,
								'actionCode': ob.jobCode,
								'actionName': ob.jobName,
								'dependencyType':ob.dependencyType,
								'srcTab': _this.getTargetTab(ob.srcTabs),
								'srcTabs':ob.srcTabs ||[],
								'targetTab': _this.getTargetTab(ob.targetTabs),
								'targetTabs':ob.targetTabs ||[],//目标表列表
								'relJobList': jx.relJobList,//作业依赖列表
								'relGroupCode':jx.relGroups ,
								'relJobCode': jx.relJobs ,
								'relJobName': jx.relJobNames ,
								'eventCode': jx.relEvents ,
								'eventName': jx.relEventNames ,
								'relEventList': jx.relEventList,
								'joblist3': [],
								'joblist3op':[],
								'jobRelInfoList':ob.jobRelInfoList ||[]
							};


							data3Rel.push(jp);
						}


					}
					_this.data3 = data3Rel || [];
				},
				cancelFn: function() {
					 var _this = this;
					_this.loading2 = false;
					_this.loading3 = false;
					_this.dialogVisible = false;
				},
				cancelFnflex: function() {
					this.dialogVisibleflex = false;
				},
				nextOneflex: function() {
					var _this = this;
					if (_this.activeflex == 1) { //校验第一步
						//校验必输
						_this.$refs.refForm1flex.validate(function(valid) {
							if (valid) {
								//新增校验版本号
								if(_this.editflag == 'add'){
										//校验版本号是否已经能存在
										var exist = _this.versionExit(_this.formdata1flex.versionNo || '');
										if(!exist){
											return;
										}
								}	
								 //给触发器参数赋值系统编码
								 _this.triggerParams = {
										condition: JSON.stringify({
											appCode:_this.searchFormdata.appCode
										})
														};	
								_this.activeflex = _this.activeflex + 1;
							}
						});
					}
				},
				versionExit:function(version){//校验版本号是否已经存在
					var _this = this;
					var flag =true;
					if(version){
							//根据版本号查询列表有则提示当前版本号已存在
							var json = {
								'versionNo': version
							}
							yufp.service.request({
								method: 'GET',
								async: false,
								url: '/api/use/citiccard/jobconf/queryJobConf',
								data: json,
								callback: function(code, message, response) {
									if (response && response.code == 0 && response.data) {
											_this.$message({
												message: '该版本号已经存在！',
												type: 'warning'
											});
											flag = false;
									}
								},
							});
							
							
							
					}else{
						flag = false;
					}
					
					
					return flag;
				},
				nextOne: function() { //下一步
					var _this = this;
					if (_this.active == 1) { //第一步
						//校验必输
						_this.$refs.refForm1.validate(function(valid) {
							if (valid) {
								//如果是编辑给一个loading
								if(_this.editflag == 'edit'){
									_this.loading2 = true;
								}else if(_this.editflag == 'add'){
									//校验版本号是否已经能存在
									
									var exist = _this.versionExit(_this.formdata1.versionNo || '');
									if(!exist){
										return;
									}
								}					
								_this.active = _this.active + 1;
								_this.$nextTick(function(){
									 setTimeout(function(){
										  _this.loading2 = false;
									 },500);
									
								});

							}
						});
					} else if (_this.active == 2) { //第二部点击下一步
						//校验数据为空，然后组装数据
						if (_this.jobdisabled) { //只能查看 不编辑
							_this.active = _this.active + 1;
						} else {
							var flag = _this.VadiTwoStepData(); //校验数据的合法性
							if(!flag){
								return;
							}
							var flag1 = _this.repateData(); //不能存在相同的两条记录（应用系统，作业流，作业代码相同）（中）(作业第二部)


							if (!flag1) {
								return;
							} else {
								//获取数据，进入下一步
								_this.getThreeStepData();
							}

						}
					} else {
						_this.active = _this.active + 1;
					}

				},
				repateData: function() { //不能存在相同的两条记录（应用系统，作业流，作业代码相同）（中）(作业第二部)
					var flag = true; //默认校验成功
					var _this = this;
					var norepate = []; //不重复飞数据
					var allList = _this.data2 || [];
					for (var i in allList) {
						var find = false;
						for (var j in norepate) {
							if (allList[i].groupCode == norepate[j].groupCode && allList[i].actionName == norepate[j].actionName) {
								find = true;
								flag = false;
								this.$message({
									message: '第' + (Number(i) + 1) + '行的作业流和作业已经存在!',
									type: 'warning'
								});
								break;

							}
						}
						if (!find) {
							norepate.push(allList[i]);
						}else{
							break;
						}
					}
					return flag;
				},
				VadiTwoStepData: function() { //第二部下一步，校验数据为空，然后组装数据，获取第三步的数据
					var flag = true; //默认校验成功 
					var _this = this;
					var allList = _this.data2 || [];
					if (allList && allList.length > 0) {
						for (var item in allList) {
							var obj = allList[item];
							//获取作业类型名称，为路由的不校验执行内容
							if("-" == obj.workBaseFormData.typeCode){
								if (!obj.agentCode || !obj.groupCode || !obj.actionName  || !obj.jobTypeCode) {
									var errorLine = Number(item) + 1;
									_this.$message({
										message: '请完善第' + errorLine + '行数据!',
										type: 'warning'
									});
									flag = false;
									break;
								}	
							}else{
								if (!obj.agentCode || !obj.groupCode || !obj.actionName  || !obj.jobTypeCode || !obj.actionExec) {
									var errorLine = Number(item) + 1;
									_this.$message({
										message: '请完善第' + errorLine + '行数据!',
										type: 'warning'
									});
									flag = false;
									break;
								}						
							}
						}
					} else {
						_this.$message({
							message: '请最少配置一条作业信息!',
							type: 'warning'
						});
						flag = false;
					}
					return flag;
				},
				//根据作业id获取作业类型
				getTypeCodeById: function(id) {
					var listJob = this.jobList || [];
					var code = '';
					if (id) {
						for (var item in listJob) {
							if (id == listJob[item].key) {
								code = listJob[item].type;
								break;
							}
						}
					}
					return code;
				},
				getStep2Data: function() { //组装第二部的数据
					var _this = this;
					var allList = _this.data2 || [];
					var param = {};
					/*数据组装start*/
					var jobExts = [];
					for (var item in allList) {
						var obj = allList[item];
						var parseCode = obj.jobTypeCode;
						var parseType = this.getTypeCodeById(parseCode);
						var limitInfo = ''; //日期限制
						for (var i in obj.workAdditionalFormData.timeList) {
							limitInfo += obj.workAdditionalFormData.timeList[i].key;
						}
						var timepicker = obj.workAdditionalFormData.timepicker || []; //时间限制
						var limitBegin = (timepicker && timepicker.length > 0) ? timepicker[0] : null;
						var limitEnd = (timepicker && timepicker.length > 1) ? timepicker[1] : null;
						if(limitBegin && typeof(limitBegin) != 'string'){
							var h= limitBegin.getHours();
							var m = limitBegin.getMinutes();
							var s = limitBegin.getSeconds();
							if(Number(h) < 10){
								h = '0' + h;
							}
							if(Number(m) < 10){
								m = '0' + m;
							}
							if(Number(s) < 10){
								s = '0' + s;
							}
							limitBegin = h +'' + m +''+ s;
						}
						if(limitEnd && typeof(limitEnd) != 'string'){
							var h= limitEnd.getHours();
							var m = limitEnd.getMinutes();
							var s = limitEnd.getSeconds();
							if(Number(h) < 10){
								h = '0' + h;
							}
							if(Number(m) < 10){
								m = '0' + m;
							}
							if(Number(s) < 10){
								s = '0' + s;
							}
							limitEnd = h +'' + m +''+ s;
						}
						var inJson = {
							'appCode': _this.searchFormdata.appCode,
							'agentCode': obj.agentCode,
							'actionCode': obj.actionCode,
							'groupCode': obj.groupCode,
							'groupName': obj.groupName,
							'actionName': obj.actionName,
							'actionExec': obj.actionExec,
							'parseType': parseType,
							'parseCode': parseCode,
							'typeCode': obj.workBaseFormData.typeCode ||'C',
							'success': obj.workBaseFormData.success,
							'condType': obj.workBaseFormData.condType, //前置条件类型
							'maxRetry': obj.workBaseFormData.maxRetry, //自动重试次数
							'actionPrior': obj.workBaseFormData.actionPrior, //优先级
							'intrFlag': obj.workBaseFormData.intrFlag, //是否强制中断
							'multiFlag': obj.workBaseFormData.multiFlag, //是否多实例
							'limitBegin': limitBegin,
							'limitEnd': limitEnd,
							'limitInfo': limitInfo,
							'remark': obj.workBaseFormData.remark,
							'wftParList': obj.workExecFormData.wftParList || [], //参数信息
							'useEventCrossList': obj.workExecFormData.useEventCrossList || [], //事件信息						
						};
						jobExts.push(inJson);
					}
					return jobExts;
				},
				getData3: function() { //组装第三部的数据			'targetTabs':[],//目标表列表
					var _this = this;
					var dependencyPos = [];
					for (var item in _this.data3) {
						var jobRelInfoList = [];//依赖列表
						var ob = _this.data3[item];
						//组装源表
						var srcTabs = ob.srcTabs ||[];
						//组装目标表
						var targetTabs = ob.targetTabs ||[];
						//var targetTabs = [];
/* 						for(var iu in targetTabsOld){
							targetTabs.push({'tabName':targetTabsOld[iu].srcTar,'env':targetTabsOld[iu].env,'schema':targetTabsOld[iu].schema});
						} */
						//根据依赖类型组装依
						var relJobList = ob.relJobList ||[];
						var relEventList = ob.relEventList||[];
						if('SRCTAB' == ob.dependencyType){//源表依赖
								jobRelInfoList = ob.jobRelInfoList ||[];
						}else if('GERERAL' == ob.dependencyType){//作业依赖
						   for(var i in relJobList){
								  //解析作业
								  var relAppCode = '';
								  var relGroupCode = '';
								  var relJobCode = '';
								  var relJobName = '';
								  var eventAppCode = '';
								  var eventCode = '';
								  var eventName = '';
								  var eventType = '';
								  var defaultEventCode = relJobList[i].defaultEventCode || '';
								  relAppCode = relJobList[i].relAppCode;
								  relGroupCode = relJobList[i].relGroupCode;
								  relJobCode = relJobList[i].relJobCode;	
								  relJobName = relJobList[i].relJobName;															
								  var jobRelInfo = {
									   'relAppCode':relAppCode,
									   'relGroupCode':relGroupCode,
									   'relJobCode':relJobCode,
									   'relJobName':relJobName,
									   'eventAppCode':eventAppCode,
									   'eventCode':eventCode,
									   'eventName':eventName,
									   'eventType':eventType ,
									   'defaultEventCode':defaultEventCode
								  };
								  jobRelInfoList.push(jobRelInfo);
						   }
							
						}else if('EVENT' == ob.dependencyType){//事件依赖
							for(var i in relEventList){
								  //解析作业
								  var relAppCode = '';
								  var relGroupCode = '';
								  var relJobCode = '';
								  var relJobName = '';
								  var eventAppCode = '';
								  var eventCode = '';
								  var eventName = '';
								  var eventType = '';
								  var defaultEventCode = relEventList[i].defaultEventCode || '';
									eventAppCode = relEventList[i].eventAppCode;
									eventCode = relEventList[i].eventCode;
									eventName = relEventList[i].eventName;
									eventType = relEventList[i].eventType;								  							  
								  var jobRelInfo = {
									   'relAppCode':relAppCode,
									   'relGroupCode':relGroupCode,
									   'relJobCode':relJobCode,
									   'relJobName':relJobName,
									   'eventAppCode':eventAppCode,
									   'eventCode':eventCode,
									   'eventName':eventName,
									   'eventType':eventType  ,
									   'defaultEventCode':defaultEventCode
								  };
								  jobRelInfoList.push(jobRelInfo);
							}
						}
						
						
						var json = {
							'appCode': _this.searchFormdata.appCode,
							'groupCode': ob.groupCode,
							'jobCode': ob.jobCode,
							'dependencyType':ob.dependencyType,
							'srcTabs': srcTabs,
							'targetTabs': targetTabs,
							'jobRelInfoList': jobRelInfoList || [] //依赖
						};
						dependencyPos.push(json);
					}
					return dependencyPos;
				},
				vadistep3: function() { //校验第三部的额数据
					var flag = false;
					var datas = this.data3 || [];
					//1同一作业不能同时又两条相同事件的记录
					var vidilist = [];
					for(var item in datas){
						  var  appCode = datas[item].appCode;
						  var  groupCode = datas[item].groupCode;
						  var  actionCode = datas[item].jobCode;
						  var  relAppCode = datas[item].relAppCode;
						  var  relGroupCode = datas[item].relGroupCode;
						  var  relJobCode = datas[item].relJobCode;
						  var  eventAppCode = datas[item].eventAppCode;
						  var  eventCode = datas[item].eventCode;
						  var eventType = datas[item].eventType;
						  var dependencyType = datas[item].dependencyType;
						  
						  if(!groupCode || !actionCode || !dependencyType){
							  flag = true;
							  this.$message({
							  	message: '第' + (Number(item )+ 1) + '行的作业流，作业，依赖类型不能为空！',
							  	type: 'warning'
							  });
							  break;
						  }
						  
						  
						  //当前行为源表依赖，源表不能为空
						  if('SRCTAB' == dependencyType){
								if(!datas[item].srcTab && !datas[item].targetTab){
									flag = true;
									this.$message({
										message: '第' + (Number(item )+ 1) + '行为源表依赖，并且源表和目标表都为空，请确认！',
										type: 'warning'
									});
									break;
								}	  
						  }else if('GERERAL' == dependencyType){
							  if(!relJobCode){
							  	flag = true;
							  	this.$message({
							  		message: '第' + (Number(item )+ 1) + '行普通依赖的依赖作业为空，请确认！',
							  		type: 'warning'
							  	});
							  	break;
							  }
							  
						  }else if('EVENT' == dependencyType){
							  if(!eventCode){
							  	flag = true;
							  	this.$message({
							  		message: '第' + (Number(item )+ 1) + '行事件依赖的依赖事件为空，请确认！',
							  		type: 'warning'
							  	});
							  	break;
							  }
						  }

						  var fg = false;					  
						  for(var it in vidilist){
							   if( groupCode == vidilist[it].groupCode　&& actionCode == vidilist[it].jobCode ){ //作业相同
									//依赖类型相同
										if(dependencyType == vidilist[it].dependencyType){
											 fg = true;
											 flag = true;
											 this.$message({
											 	message: '第' + (Number(item )+ 1) + '行的数据和第'+(Number(it )+ 1)+'行的依赖类型重复，同种依赖只能保留一条！',
											 	type: 'warning'
											 });
											 break;
										}    
							   }

							  
						  }	
						  if(!fg){
						  		vidilist.push(datas[item]);
						  }else{
							  break;
						  }
					}
					return flag;
				},
				getThreeStepData: function() { //第二部下一步，校验数据为空，然后组装数据，获取第三步的数据
					var _this = this;
					var allList = _this.data2 || [];				
					var param = {};
					/*数据组装start*/
					_this.loading2 = true;
					//第二部的数据
					param.versionNo = _this.formdata1.versionNo;
					var jobExts = _this.getStep2Data();
					/*数据组装end*/
					/*校验数据*/

					param.jobExts = jobExts;
					/*loading start*/
					yufp.service.request({
						method: 'POST',
						url: '/api/use/citiccard/jobconf/getJobRefs',
						data: param,
						callback: function(code, message, response) {
							/*loading结束*/
							_this.loading2 = false;
							if (response && response.code == 0) {
								_this.active = _this.active + 1; //进入下一步
								_this.setStep3(response.data.jobRefs || [], response.data.jobGroups || []);
							} else {
								_this.$message({
									message: response.message,
									type: 'warning'
								});
								return;
							}
						},
					});
				},
				//根据依赖类型，解析作业依赖和事件依赖
				getRelJson:function(type,list){
					var relJobs = '';//作业依赖字符串
					var relJobNames = '';//作业依赖字符串
					var relGroups = '';//作业流依赖字符串
					var relJobList = [];//作业依赖列表
					var relEvents = '';//事件依赖字符串
					var relEventNames = '';//事件名称字符串
					var relEventList = [];//事件依赖列表
					
					if(type && list && list.length> 0){
						for(var item in list){
							var relAppCode = list[item].relAppCode;//依赖系统
							var relGroupCode = list[item].relGroupCode;//依赖作业流
							var relJobCode = list[item].relJobCode;//依赖作业
							var relJobName = list[item].relJobName;//依赖作业
							var eventAppCode = list[item].eventAppCode;//事件系统
							var eventType = list[item].eventType;//事件类型
							var eventCode = list[item].eventCode;//事件编码
							var eventName = list[item].eventName;//事件名称
							var defaultEventCode = list[item].defaultEventCode || '';//默认事件代码
							if('SRCTAB' == type){//源表依赖
								 if(relJobCode){
									 relJobs = relJobs + relJobCode + ';';
								 }
								 if(relJobName){
								 	 relJobNames = relJobNames + relJobName + ';';
								 }
								 if(relGroupCode){
									 relGroups = relGroups + relGroupCode+';';
								 }
								 if(eventCode){
									 relEvents = relEvents + eventCode+';';
								 }
								if(eventName){
									 relEventNames = relEventNames + eventName+';';
								}
								if(relAppCode && relJobCode){
									relJobList.push({
										'relAppCode':relAppCode,
										'relGroupCode':relGroupCode,
										'relJobName':relJobName,
										'relJobCode':relJobCode,
										'defaultEventCode':defaultEventCode
									});
								}
								if(eventAppCode && eventCode){
									relEventList.push({
										'eventAppCode':eventAppCode,
										'eventCode':eventCode,
										'eventName':eventName,
										'eventType':eventType,
										'defaultEventCode':defaultEventCode
									});
								}
							}else if('GERERAL' == type){//作业依赖
								if(relJobCode){
										relJobs = relJobs + relJobCode + ';';
								}
								if(relJobName){
										relJobNames = relJobNames + relJobName + ';';
								}
								if(relGroupCode){
										relGroups = relGroups + relGroupCode+';';
								}
								if(relAppCode && relJobCode){
									relJobList.push({
										'relAppCode':relAppCode,
										'relGroupCode':relGroupCode,
										'relJobName':relJobName,
										'relJobCode':relJobCode,
										'defaultEventCode':defaultEventCode
									});
								}
								
							}else if('EVENT' == type){//事件依赖
								if(eventCode){
									 relEvents = relEvents + eventCode+';';
								 }
								if(eventName){
									 relEventNames = relEventNames + eventName+';';
								}
								if(eventAppCode && eventCode){
									relEventList.push({
										'eventAppCode':eventAppCode,
										'eventCode':eventCode,
										'eventName':eventName,
										'eventType':eventType,
										'defaultEventCode':defaultEventCode
									});
								}
							}else{
								console.log('不能解析的依赖类型');
							}
						}
						
						
						
						
					}
					return {
							'relJobs':relJobs,'relJobNames':relJobNames,'relGroups':relGroups,'relJobList':relJobList,
							'relEvents':relEvents,'relEventNames':relEventNames,
							'relEventList':relEventList
							};
					
				},
				//根据依赖类型，解析作业依赖和事件依赖
				getRelJsonone:function(type,list){
					var relJobs = '';//作业依赖字符串
					var relJobNames = '';//作业依赖字符串
					var relGroups = '';//作业流依赖字符串
					var relJobList = [];//作业依赖列表
					var relEvents = '';//事件依赖字符串
					var relEventNames = '';//事件名称字符串
					var relEventList = [];//事件依赖列表
					if(type && list && list.length> 0){
						for(var item in list){
							if('SRCTAB' == type){//源表依赖
									var relAppCode = list[item].relAppCode || '';//依赖系统
									var relGroupCode = list[item].relGroupCode|| '';//依赖作业流
									var relJobCode = list[item].relJobCode|| '';//依赖作业
									var relJobName = list[item].relJobName|| '';//依赖作业
									var eventAppCode = list[item].eventAppCode|| '';//事件系统
									var eventType = list[item].eventType|| '';//事件类型
									var eventCode = list[item].eventCode|| '';//事件编码
									var eventName = list[item].eventName|| '';//事件名称
									var defaultEventCode = list[item].defaultEventCode || '';//默认事件代码
								 if(relJobCode){
									 relJobs = relJobs + relJobCode + ';';
								 }
								 if(relJobName){
								 	 relJobNames = relJobNames + relJobName + ';';
								 }
								 if(relGroupCode){
									 relGroups = relGroups + relGroupCode+';';
								 }
								 if(eventCode){
									 relEvents = relEvents + eventCode+';';
								 }
								if(eventName){
									 relEventNames = relEventNames + eventName+';';
								}
								if(relAppCode && relJobCode){
									relJobList.push({
										'relAppCode':relAppCode,
										'relGroupCode':relGroupCode,
										'relJobName':relJobName,
										'relJobCode':relJobCode,
										'defaultEventCode':defaultEventCode
									});
								}
								if(eventAppCode && eventCode){
									relEventList.push({
										'eventAppCode':eventAppCode,
										'eventCode':eventCode,
										'eventName':eventName,
										'eventType':eventType,
										'defaultEventCode':defaultEventCode
									});
								}
							}else if('GERERAL' == type){//作业依赖
									var relAppCode = '';
									var relGroupCode = '';
									var relJobCode = '';
									var relJobName = '';
									var eventAppCode = '';
									var eventCode = '';
									var eventName = '';
									var eventType = '';
									var defaultEventCode = list[item].defaultEventCode || '';
									relAppCode = list[item].relAppCode;
									relGroupCode = list[item].relGroupCode;
									relJobCode = list[item].relJobCode;	
									relJobName = list[item].relJobName;
							
								if(relJobCode){
										relJobs = relJobs + relJobCode + ';';
								}
								if(relJobName){
										relJobNames = relJobNames + relJobName + ';';
								}
								if(relGroupCode){
										relGroups = relGroups + relGroupCode+';';
								}
								if(relAppCode && relJobCode){
									relJobList.push({
										'relAppCode':relAppCode,
										'relGroupCode':relGroupCode,
										'relJobName':relJobName,
										'relJobCode':relJobCode,
										'defaultEventCode':defaultEventCode
									});
								}
								
							}else if('EVENT' == type){//事件依赖
								//解析作业
								var relAppCode = '';
								var relGroupCode = '';
								var relJobCode = '';
								var relJobName = '';
								var eventAppCode = '';
								var eventCode = '';
								var eventName = '';
								var eventType = '';
								var defaultEventCode =list[item].defaultEventCode || '';
								eventAppCode = list[item].eventAppCode;
								eventCode = list[item].eventCode;
								eventName = list[item].eventName;
								eventType = list[item].eventType;	
								if(eventCode){
									 relEvents = relEvents + eventCode+';';
								 }
								if(eventName){
									 relEventNames = relEventNames + eventName+';';
								}
								if(eventAppCode && eventCode){
									relEventList.push({
										'eventAppCode':eventAppCode,
										'eventCode':eventCode,
										'eventName':eventName,
										'eventType':eventType,
										'defaultEventCode':defaultEventCode
									});
								}
							}else{
								console.log('不能解析的依赖类型');
							}
						}
					}
					return {
							'relJobs':relJobs,'relJobNames':relJobNames,'relGroups':relGroups,'relJobList':relJobList,
							'relEvents':relEvents,'relEventNames':relEventNames,
							'relEventList':relEventList
							};
					
				},
				getName:function(code,list){
					var name = '';
					for(var item in list){
						 if(code == list[item].actionCode){
							 name = list[item].actionName;
							 break;
						 }
					}
					return name;
				},
				setStep3: function(showList, selList) {
					var _this = this;
					//showList 默认解析出来的作业关系信息
					//selList:作业流下拉框 和作业下拉框
					var flowList = [];
					this.setp3flowCodeList = selList || [];
					for (var item in showList) {
						var list3 = _this.getJoblist3(showList[item].groupCode) || [];
						var actionName = _this.getName(showList[item].jobCode,list3);//根据编码获取作业名称
						//根据依赖类型，解析作业依赖和事件依赖
						var jx = _this.getRelJson(showList[item].dependencyType,showList[item].jobRelInfoList);						
						var jp = {
							'jobCode': showList[item].jobCode,//备用字段  actionCode为空（不知原因）
							'actionName':actionName,
							'groupCode': showList[item].groupCode,
							'actionCode': showList[item].jobCode,
							'dependencyType':showList[item].dependencyType,
							'srcTab': _this.getTargetTab(showList[item].srcTabs),
							'srcTabs':showList[item].srcTabs ||[],
							'targetTab': _this.getTargetTab(showList[item].targetTabs),
							'targetTabs':showList[item].targetTabs ||[],//目标表列表
							'relJobList': jx.relJobList,//作业依赖列表
							'relGroupCode':jx.relGroups ,
							'relJobCode': jx.relJobs ,
							'relJobName': jx.relJobNames ,
							'eventCode': jx.relEvents ,
							'eventName': jx.relEventNames ,
							'relEventList': jx.relEventList,
							'joblist3': list3,
							'joblist3op':[{'actionCode':showList[item].jobCode,'actionName':actionName}],
							'jobRelInfoList':showList[item].jobRelInfoList ||[]
						};
						flowList.push(jp);
					}
					this.data3 = flowList;

					//解析当前新增的作业流，用于选择依赖当前作业
					var creatjob = []; //目前新增的作业流
					var hadone = this.data2 || [];
					for (var i in hadone) {
						var groupCode = hadone[i].groupCode;
						var groupName = hadone[i].groupName;
						var actionCode = hadone[i].actionCode;
						var actionName = hadone[i].actionName;
						//判断flowList中，groupCode    actionCode 不同的添加
						var flag = false;
						for (var it in creatjob) {
							if (creatjob[it].groupCode == groupCode && creatjob[it].actionCode == actionCode) {
								flag = true;
							}
						}
						if (!flag) {
							creatjob.push({
								'appCode': _this.searchFormdata.appCode,
								'groupCode': groupCode || '',
								'groupName': groupName || '',
								'actionCode': actionCode || '',
								'actionName': actionName || '',
							});
						}

					}
					this.hadJobDataOld = creatjob || [];
					this.hadJobData = creatjob || [];

				},
				getTargetTab: function(arr) { //根据列表获取字符串  按;号分割
				
				    var sb = '';
					if(arr && arr.length > 0){
						 sb =  arr.reduce(function(pre,item){
							 return pre + item.tabName+';';	
						 
						 },'')
					}
					return sb;
				},
				setJoblist3: function(event,cell) { //根据作业流编码 设置作业列表
					var _this = this;
					code = cell.groupCode;
					if(event){
						thisRow = cell.index;
						thisval = code;
						return; //下拉框展开不触发改变事件
					}
					//下拉框关闭事件
					if(thisval == code){ //前后一样不改变
						return;
					}
				
					var flowlist3 = this.setp3flowCodeList || [];
					var codelist = [];
					if (code && flowlist3.length > 0) {
						for (var item in flowlist3) {
							if (code == flowlist3[item].groupCode) {
								codelist = flowlist3[item].wftLstList || [];
								break;
							}
						}
					}
					//判断当前修改的是第几行
					if(_this.data3[thisRow]){
						_this.data3[thisRow].joblist3 = codelist;
						_this.data3[thisRow].actionCode = '';					
					}
				    _this.resetRef();//重置依赖
								
				},
				resetRef:function(){ //清空依赖
					var _this = this;
					if(thisRow || Number(thisRow) == 0){//0为false
						_this.data3[thisRow].srcTab = '';
						_this.data3[thisRow].srcTabs = [];
						_this.data3[thisRow].targetTab = '';
						_this.data3[thisRow].targetTabs = [];
						_this.data3[thisRow].relGroupCode = '';
						_this.data3[thisRow].relJobCode = '';
						_this.data3[thisRow].relAppCode = '';
						_this.data3[thisRow].relJobName = '';
						_this.data3[thisRow].relJobList = [];
						_this.data3[thisRow].eventCode = '';
						_this.data3[thisRow].eventAppCode = '';
						_this.data3[thisRow].eventName = '';
						_this.data3[thisRow].relEventList = [];
						_this.data3[thisRow].jobRelInfoList = [];
						
					}
					
					//return;
/* 					if(_this.data3[_this.editDowIndex3].srcTabs.length > 0 ||
					   _this.data3[_this.editDowIndex3].targetTabs.length > 0 ||
					   _this.data3[_this.editDowIndex3].relJobList.length > 0 ||
					   _this.data3[_this.editDowIndex3].relEventList.length > 0 ){
						_this.$confirm('若修改作业流编码、作业名称和依赖类型，依赖关系将会重新解析，确认修改吗？', '提示', {
							confirmButtonText: '确定',
							cancelButtonText: '取消',
							type: 'warning',
							center: true,
							callback: function(action) {
								if (action === 'confirm') {
										_this.data3[_this.editDowIndex3].srcTab = '';
										_this.data3[_this.editDowIndex3].srcTabs = [];
										_this.data3[_this.editDowIndex3].targetTab = '';
										_this.data3[_this.editDowIndex3].targetTabs = [];
										_this.data3[_this.editDowIndex3].relGroupCode = '';
										_this.data3[_this.editDowIndex3].relJobCode = '';
										_this.data3[_this.editDowIndex3].relAppCode = '';
										
										_this.data3[_this.editDowIndex3].relJobList = [];
										_this.data3[_this.editDowIndex3].eventCode = '';
										_this.data3[_this.editDowIndex3].eventAppCode = '';
										_this.data3[_this.editDowIndex3].eventName = '';
										_this.data3[_this.editDowIndex3].relEventList = [];
										_this.data3[_this.editDowIndex3].jobRelInfoList = [];
										
								} else {
									
								}
							}
						});
						   
						
					} */
					
					
				},
				getJoblist3: function(code) { //根据作业流编码 获取作业列表
					var _this = this;
					var flowlist3 = this.setp3flowCodeList || [];
					var codelist = [];
					if (code && flowlist3.length > 0) {
						for (var item in flowlist3) {
							if (code == flowlist3[item].groupCode) {
								codelist = flowlist3[item].wftLstList || [];
								break;
							}
						}
					}
					return codelist;
				},
				lastOne: function() { //上一步
					var _this = this;
					/*如果为第三步点击上一步，给予提示，因为在此点下一步会重新解析数据*/
					if(_this.active == 3 && _this.data3.length > 0){
						 _this.$confirm('当前已解析出作业的依赖关系,确定要返回上一步重新解析吗？', '提示', {
						 	confirmButtonText: '确定',
						 	cancelButtonText: '取消',
						 	type: 'warming',
						 	center: true
						 }).then(() => {
								_this.active = _this.active - 1;
						 }).catch(() => {
								
						 })
						
					}else{
						_this.active = _this.active - 1;
					}
				},
				lastOneflex: function() { //上一步
					this.activeflex = this.activeflex - 1;
				},
				saveFnflex: function(covertype) { //保存作业流自动配置的数据
					//1.保存第一步的信息
					var _this = this;
					var jobConf = {};
					var url = '/api/use/citiccard/jobconf/save';
					if (_this.editflag == 'edit') {
						url = '/api/use/citiccard/jobconf/update';
					}
					if (covertype == 'Y' || covertype == 'N') {
						jobConf.cover = covertype;
						url = '/api/use/citiccard/jobconf/importSave';
						jobConf.opType = 'IMPORT'; //操作类型
					} else {
						jobConf.opType = 'CREATE'; //操作类型
					}
					jobConf.appCode = _this.searchFormdata.appCode;
					jobConf.confType = 'flow'; //配置类型：作业流
					//1.1第一步参数
					jobConf.versionNo = _this.formdata1flex.versionNo;
					jobConf.versionRemark = _this.formdata1flex.versionRemark;
					//2.保存第二步的信息
					var jobFlowRels = _this.getFlowData(); //获取作业流第二部的数据		
					if (!jobFlowRels || jobFlowRels.length == 0) {
						return;
					}
					jobConf.jobFlowRels = jobFlowRels;
					yufp.service.request({
						method: 'POST',
						url: url,
						data: jobConf,
						callback: function(code, message, response) {
							if (response && response.code == 0) {
								//清空数据
								_this.clearAllFlex();
								_this.dialogVisibleflex = false;
								//刷新
								_this.$refs.refTable.remoteData();
							} else {
								_this.$message({
									message: response.message,
									duration:5000,
									type: 'warning'
								});
								return;
							}
						},
					});
				},
				saveFnflexImport: function() {
					var _this = this;
					if (_this.flowdisabled) { //xml导入确认,入库操作
					if(_this.cover == 'Y'){
							var cover = '';
							_this.$confirm('当前xml文件已经导入，是否覆盖？', '提示', {
								confirmButtonText: '确认',
								cancelButtonText: '取消',
								type: 'warming',
								center: true
							}).then(() => {
								cover = 'Y';
								_this.saveFnflex(cover)
							}).catch(() => {
	/* 							cover = 'N';
								_this.saveFn(cover) */
							})			
					}else{
						_this.saveFnflex('N')
					}
					}
				},
				clearAllFlex: function() {
					var _this = this;
					_this.editflag = 'add';
					_this.activeflex = 1;
					_this.active = 1;
					_this.formdata1.versionNo = '';
					_this.formdata1.versionRemark = '';
					_this.formdata1flex.versionNo = '';
					_this.formdata1flex.versionRemark = '';
					_this.data2 = [];
					_this.data3 = [];
					_this.data2flex = [];

				},
				getFlowData: function() {
					var _this = this;
					var flowList = [];
					var flah = true;
					var datalist = _this.data2flex || [];
					for (var item in datalist) {
						var ob = datalist[item];
						if (!ob.groupCode || !ob.groupName || !ob.formDataTask.triggerId || !ob.offSet) {
							_this.$message({
								message: '请完善第' + (Number(item )+ 1) + '行的数据！',
								type: 'warning'
							});
							flowList = [];
							flah = false;
							break;
						} else {
							if (isNaN(ob.offSet)) {
								_this.$message({
									message: '第' + (Number(item )+ 1) + '行的时点偏移量应为-99到0的整数！',
									type: 'warning'
								});
								flowList = [];
								flah = false;
								break;
							} else {
								if (Number(ob.offSet) > 0) {
									_this.$message({
										message: '第' + (Number(item )+ 1) + '行的时点偏移量应为-99到0的整数！',
										type: 'warning'
									});
									flowList = [];
									flah = false;
									break;
								}
							}
						}

						var jobFlowExt = {
							'appCode': _this.searchFormdata.appCode,
							'appName': '',
							'groupCode': ob.groupCode,
							'groupName': ob.groupName,
							'offSet': ob.offSet,
							'taskType': 'T',
							// 'triggerTime':ob.triggerTime ||'',
							//'flowRemark':'',
							// 'cycleTime':ob.cycleTime || '',//周期时点
							'calendarCode': ob.formDataTask.calendarCode || '', //工作日历
							'effectDate': ob.formDataTask.effectDate || '', //生效日期
							'expireDate': ob.formDataTask.expireDate || '', //失效日期,
							'validFlag': ob.formDataTask.validFlag || '', //任务状态
							'triggerNm': ob.formDataTask.triggerNm || '', //任务触发器
							'triggerId': ob.formDataTask.triggerId || '', //任务触发器id
							'useTaskTimer':ob.formDataTask.useTaskTimer || {},
							//'InSideFlag':'N',//使用内置时点
							'insideCycleTime': ob.formDataTask.insideCycleTime || '', //内置时点
							'remark': ob.formDataTask.remark || '', //备注
							'useTaskParamList': ob.formDataTask.paramDatas || [] //任务参数
						};
						//判断数据重复问题
						var ff = true;
						for(var i in flowList){
							 if(flowList[i].groupCode == jobFlowExt.groupCode){
								 ff = false;
								 _this.$message({
								 	message: '第' + (Number(item )+ 1) + '行的作业流编码重复！',
								 	type: 'warning'
								 });
								 break;
							 }
						}
						if(!ff){
							return;
						}
						
						flowList.push(jobFlowExt);
					}
					if (flah && flowList.length == 0) {
						_this.$message({
							message: '请至少添加一条作业流！',
							type: 'warning'
						});
					}
					return flowList;
				},
				tableRowClassName({
					row,
					rowIndex
				}) {
					//吧每一行的索引放入row
					row.index = rowIndex;
				},
				tableRowClassNameflex({
					row,
					rowIndex
				}) {
					//吧每一行的索引放入row
					row.index = rowIndex;
				},
				tableRowClassName3({
					row,
					rowIndex
				}) {
					//吧每一行的索引放入row
					row.index = rowIndex;
				},
				rowClickFnOne: function(row, column, cell, event) {
					this.editDowIndex = row.index;
				},
				rowClickFnOneflex: function(row, column, cell, event) {
					this.editDowIndexflex = row.index;
				},
				rowClickFnOne3: function(row, column, cell, event) {
					this.editDowIndex3 = row.index;
				},
				getUID:function(){
					function s4 (){
						return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
					}
					return (s4()+s4()+s4()+s4()+s4()+s4()+s4()+s4());
				},
				addJob2: function() { //新增作业基本信息
					var workBaseFormData = {
						typeCode:'C',//默认命令和程序
						success: 0,
						actionPrior: 5,
						maxRetry: 0,
						multiFlag: 'N',
						intrFlag: 'Y',
						condType: 'A',
						remark: ''
					}; //作业基本信息		
					var workExecFormData = {
						'wftParList': [],
						'useEventCrossList': []
					};
					var workAdditionalFormData = {
						timepicker: '',
						timeList: []
					}; //作业附件限制
					var actionCodeUID = this.getUID();//生成唯一的作业编码
					this.data2.push({
						'agentCode': '',
						'groupCode': '',
						'groupName': '',
						'actionName': '',
						'actionCode': actionCodeUID,
						'jobTypeCode': ' ',
						'actionExec': '',
						'startFlag': '0',
						'isOld': false,
						workBaseFormData,
						workExecFormData,
						workAdditionalFormData
					});

				},
				addJob2Parseflex:function(list){ //复制作业流
					
					var _this = this;
					var newlist = [];
					if(list && list.length > 0){
						for(var item in list){
								var line = list[item];
								if(line && line.length > 0){ //判定长度必须大于2
									var groupCode = '';
									var groupName = '';
									var offSet = '';
									var groupCode = '';
									var triggerId = '';
									if(line[0]){
										groupCode = line[0];
									}
									if(line.length > 1 && line[1]){
										groupName = line[1];
									}
									if(line.length > 2 && line[2]){
										offSet = line[2];
										if(isNaN(offSet)){
											offSet = '0';
										}else{
											if(Number(offSet) > 0 || Number(offSet) < -99){
												offSet = '0';
											}
										}
									}
									if(line.length > 3 && line[3]){
										triggerId = line[3];
									}
									var formDataTask = { //新增的默认数据
										taskId: '', //任务id
										taskName: '', //任务
										cycleTime: '', //周期时点
										calendarCode: '', //工作日历
										effectDate: this.getDay(), //生效日期
										expireDate: '', //失效日期,
										validFlag: 'Y', //任务状态
										triggerNm: triggerId, //任务触发器
										triggerId: triggerId, //任务触发器id
										InSideFlag: 'N', //使用内置时点
										insideCycleTime: '', //内置时点
										remark: '', //备注
										paramDatas: [] //任务参数
									}
									newlist.push({
										'groupCode': groupCode,
										'groupName': groupName,
										'time1': '',
										'offSet': offSet,
										'startFlag': '0',
										'isAdd': 'Y',
										'formDataTask': formDataTask
									});		
								}
						}
						
					}
					if(newlist.length > 0){
						_this.data2flex = _this.data2flex.concat(newlist);
					}
				},
				addJob2Parse:function(list){
					
					var _this = this;
					var newlist = [];
					if(list && list.length > 0){
						for(var item in list){
								var line = list[item];
								if(line && line.length > 2){ //判定长度必须大于2
									var workBaseFormData = {
										typeCode:'C',//默认命令和程序
										success: 0,
										actionPrior: 5,
										maxRetry: 0,
										multiFlag: 'N',
										intrFlag: 'Y',
										condType: 'A',
										remark: ''
									}; //作业基本信息		
									var workExecFormData = {
										'wftParList': [],
										'useEventCrossList': []
									};
									var workAdditionalFormData = {
										timepicker: '',
										timeList: []
									}; //作业附件限制
									var jobTypeCode = ' ';
									if(line.length >3 && line[4]){
										 if(!line[4] || '无' == line[4].trim() || !line[4].trim()){
											 jobTypeCode = ' ';
										 }else{
											 jobTypeCode = line[4] || ' ';
										 }
									}
									var actions = _this.getUID();//生成唯一的作业编码
									if(line.length >2 && line[3]){
										actions = line[3];
									}
									var sb = line.length >4 ? line[5]:'';
									var actionExecs = '';
									for(var i=0;i<sb.length;i++){
										var sbb = sb[i];
										if(sbb.charCodeAt() == 160 || sbb.charCodeAt() == 12288){
											sbb = ' ';
										}
										actionExecs = actionExecs + sbb;
									}
									newlist.push({
										'agentCode': line[0] ||'',
										'groupCode': line[1] ||'',
										'groupName': '',
										'actionName': line.length >1 ? line[2]:'',
										'actionCode': actions,
										'jobTypeCode': jobTypeCode || ' ',
										'actionExec': actionExecs,
										'startFlag': '0',
										'isOld': false,
										workBaseFormData,
										workExecFormData,
										workAdditionalFormData
									});
													
								}
						}
	
					}
					if(newlist.length > 0){
						_this.data2= _this.data2.concat(newlist);		
					}
					
				},
				addJob2flex: function() { //新增作业流信息
					var formDataTask = { //新增的默认数据
						taskId: '', //任务id
						taskName: '', //任务
						cycleTime: '', //周期时点
						calendarCode: '', //工作日历
						effectDate: this.getDay(), //生效日期
						expireDate: '', //失效日期,
						validFlag: 'Y', //任务状态
						triggerNm: '', //任务触发器
						triggerId: '', //任务触发器id
						InSideFlag: 'N', //使用内置时点
						insideCycleTime: '', //内置时点
						remark: '', //备注
						paramDatas: [] //任务参数
					}


					this.data2flex.push({
						'groupCode': '',
						'groupName': '',
						'time1': '',
						'offSet': '',
						'startFlag': '0',
						'isAdd': 'Y',
						'formDataTask': formDataTask
					});
				},
				delJob2: function() { //删除当前选中
					var _this = this;
					var sellist =  _this.data2Sel
					var oldlist = _this.data2 || [];
					var newlist = [];
					for(var ou in oldlist){
						var flag = false;	
						for (var item in sellist) {
								if(oldlist[ou].groupCode == sellist[item].groupCode && oldlist[ou].actionCode == sellist[item].actionCode){
									flag = true;
									break;
								}
						}
						if(!flag){
							newlist.push(oldlist[ou]);
						}
					}
					_this.data2 = newlist || [];
				},
				delJob2flex: function() { //删除当前选中

					var _this = this;
					var oldlist = _this.data2flex || [];
					var newlist = [];
					for (var item in oldlist) {
						if (_this.editDowIndexflex != item) {
							newlist.push(oldlist[item]);
						}
					}
					_this.data2flex = newlist || [];
				},
				addJob3: function() {
					this.data3.push({
						'jobCode': '',
						'actionName':'',
						'groupCode': '',
						'actionCode': '',
						'dependencyType':'',
						'srcTab': '',
						'srcTabs': [],
						'targetTab': '',
						'targetTabs':[],
						'relGroupCode': '',
						'relJobCode': '',
						'relJobName': '',
						'relAppCode': '',
						'relAppName': '',
						'relJobList':[],
						'eventCode': '',
						'eventAppCode': '',
						'eventName': '',
						'relEventList':[],
						'joblist3': [],
						'joblist3op':[],
						'jobRelInfoList':[]
					});
				},
				addJob3Parse:function(list){
					var _this = this;
					if(list && list.length > 0){
						var fg = true;
						var adddata3 = [];
						for(var item in list){
							 let ob = list[item];
							 let groupCode = '';
							 let actionCode = '';
							 let actionName = '';//通过作业名称找作业流代码
							 let relActionName = '';
							 let dependencyType = 'GERERAL';
							 let relJobList = [];//依赖作业列表
							 let relstring = '';//依赖作业的字符串，按逗号分隔
							 var codelist = [];
							 if(ob && ob.length > 0){
								  groupCode = ob[0];
							 }
							 if(ob && ob.length > 1){
							 	  actionName = ob[1];
							 }			 
							 if(ob && ob.length > 2){
							 	  dependencyType = ob[2];
								  if(dependencyType && dependencyType.trim()){
									   dependencyType = dependencyType.trim();
									   if(dependencyType == '普通依赖'){
										   dependencyType = 'GERERAL';
									   }
								  }  
							 }
							 if(groupCode && groupCode.trim()){
								 //判断该作业流编码存在
								 var fgs = false;
								 for(var s in _this.setp3flowCodeList){
									  if(groupCode == _this.setp3flowCodeList[s].groupCode){
										  fgs = true;
										  break;
									  }
								 }
								 if(!fgs){
									 _this.$message({
									 	message: '第'+ (Number(item) + 1)+'行的作业流编码不存在!',
									 	type: 'warning'
									 });
									 fg = false;
									 break;
								 }else{
									//根据作业名称匹配，作业编码
									codelist = _this.getJoblist3(groupCode);
									var sgg = false;//判断作业名称是否找到作业.
									for(var its in codelist){
										 if(actionName &&actionName == codelist[its].actionName){
											 actionCode = codelist[its].actionCode;
											 sgg = true;
										 }
									}
									if(!sgg){
										_this.$message({
											message: '第'+ (Number(item) + 1)+'行的作业名称不存在!',
											type: 'warning'
										});
										fg = false;
										break;
									}
								 } 
							 }else{
								 _this.$message({
								 	message: '第'+ (Number(item) + 1)+'行的作业流编码不存在!',
								 	type: 'warning'
								 });
								 fg = false;
								 break;
							 }
							 if(dependencyType != 'GERERAL'){
								 _this.$message({
								 	message: '第'+ (Number(item) + 1)+'行的依赖类型只能为普通依赖!',
								 	type: 'warning'
								 });
								 fg = false;
								 break;
							 }
							 if(ob && ob.length > 5){
							 	  relActionName = ob[5];
							 }
							 //根据名称解析作业依赖
							 var newsrcjson = _this.getRelList(groupCode,relActionName);
							 var fgt = newsrcjson.chenkPOst;
							 if(!fgt){
								 break;
							 }
							 var newsrc = newsrcjson.existRel || [];
							 
							 
							 var relGroupCode = newsrc.reduce(function(pre,item){
							 	if(item.relGroupCode){
							 		return pre + item.relGroupCode+';';	
							 	}else{
							 		return pre;
							 	}
							 },'');
							 var relJobCode = newsrc.reduce(function(pre,item){
							 	if(item.relJobCode){
							 		return pre + item.relJobCode+';';	
							 	}else{
							 		return pre;
							 	}
							 },'');
							 
							 var relJobName = newsrc.reduce(function(pre,item){
							 	if(item.relJobName){
							 		return pre + item.relJobName+';';	
							 	}else{
							 		return pre;
							 	}
							 },'');
							adddata3.push({
								'jobCode': actionCode,
								'actionName':actionName,
								'groupCode':groupCode,
								'actionCode': actionCode,
								'dependencyType':dependencyType,
								'srcTab': '',
								'srcTabs': [],
								'targetTab': '',
								'targetTabs':[],
								'relGroupCode': relGroupCode,
								'relJobCode': relJobCode,
								'relJobName': relJobName,
								'relAppCode': _this.searchFormdata.appCode || '',
								'relAppName': _this.searchFormdata.appName || '',
								'relJobList':newsrc || [],
								'eventCode': '',
								'eventAppCode': '',
								'eventName': '',
								'relEventList':[],
								'joblist3': codelist ||[],
								'joblist3op':[{'actionCode':actionCode,'actionName':actionName}],
								'jobRelInfoList':[]
							});
						}
						if(!fg){
							return
						}else{
							_this.data3 = _this.data3.concat(adddata3);
						}
					}
				},
				//根据名称解析作业依赖
				getRelList: function(groupCode,actionName){
					var _this = this;
					var actionNameArr;
					var rellist = [];
					var existRel = [];
					var noExistRel = [];
				    var hadJobData = _this.hadJobData ||[];
					if(actionName && actionName.trim()){
						 actionNameArr = actionName.trim().split(',');
						 if(actionNameArr &&actionNameArr.length > 0){
							  for(var i in actionNameArr){
								  var actionName = actionNameArr[i];
								  var actionCode = '';
								  var actionName1 = '';
								  //1.根据作业流编码和作业名称找存量的依赖
								  var find = false;
								  for(var q in hadJobData){
									  if(groupCode == hadJobData[q].groupCode && actionName == hadJobData[q].actionCode){
										  actionCode = hadJobData[q].actionCode;
										  actionName1 = hadJobData[q].actionName;
										  find = true;
										  break;
									  }
								  }
								  if(find){
									existRel.push({'relAppCode':_this.searchFormdata.appCode,'relGroupCode':groupCode,'relJobName':actionName1,'relJobCode':actionCode});  
								  }else{
									noExistRel.push({'relAppCode':_this.searchFormdata.appCode,'relGroupCode':groupCode,'relJobName':actionName,'relJobCode':actionName});  
								  }			  
							  }
						 }
					}
				    //2.存量的找不到去后台查询
					var chenkPOst = true;
					if(noExistRel &&　noExistRel.length > 0){
							var actionCodes = [];
							for(var item in noExistRel){
								actionCodes.push(noExistRel[item].relJobName);
							}
							var inparams ={
								'appCode':_this.searchFormdata.appCode,
								'groupCode':groupCode,
								'actionCodes':actionCodes,
							}
							yufp.service.request({
								method: 'POST',
								url: 'api/use/citiccard/jobconf/checkActionCodes',
								async:false,
								data: inparams,
								callback: function(code, message, response) {
									if (response.code == 0) {
											//表明添加的历史以来全部正确,将依赖添加到依赖		
											existRel = existRel.concat(noExistRel);
									} else {
										chenkPOst = false;
										_this.$message({ message: response.message, type: "warning", duration: 6000 });
									}
								}
							});
					}
					return {'existRel':existRel,'chenkPOst':chenkPOst};
				},
				//获取存量的依赖
				getRelJsonExcel:function(groupCode,actionName){


					
				},
				delJob3: function() {
					var _this = this;
					var sellist =  _this.data3Sel || [];
					var oldlist = _this.data3 || [];
					var newlist = [];
					for(var ou in oldlist){
						var flag = false;	
						for (var item in sellist) {
								if(sellist[item].groupCode == oldlist[ou].groupCode && sellist[item].jobCode == oldlist[ou].jobCode && sellist[item].dependencyType == oldlist[ou].dependencyType){ //角标相同，需要删除
									flag = true;
									break;
								}
						}
						if(!flag){
							newlist.push(oldlist[ou]);
						}
					}
					_this.data3 = newlist || [];
	/* 				var _this = this;
					var oldlist = _this.data3 || [];
					var newlist = [];
					for (var item in oldlist) {
						if (_this.editDowIndex3 != item) {
							newlist.push(oldlist[item]);
						}
					}
					_this.data3 = newlist || []; */
				},
				saveFnImport: function() { //导入的作业保存
					var _this = this;
					if (_this.jobdisabled) { //xml导入确认,入库操作
						if(_this.cover == 'Y'){
								var cover = '';
								_this.$confirm('当前xml文件已经导入，是否覆盖？', '提示', {
									confirmButtonText: '确认',
									cancelButtonText: '取消',
									type: 'warming',
									center: true
								}).then(() => {
									cover = 'Y';
									_this.saveFn(cover)
								}).catch(() => {
		/* 							cover = 'N';
									_this.saveFn(cover) */
								})			
						}else{
							_this.saveFn('N')
						}

					}
				},
				saveFn: function(covertype) { //保存作业自动配置

					var _this = this;
					//1.组装入参
					var jobConf = {};
					var url = '/api/use/citiccard/jobconf/save';
					if (_this.editflag == 'edit') {
						url = '/api/use/citiccard/jobconf/update';
					}
					if (covertype == 'Y' || covertype == 'N') {
						jobConf.cover = covertype;
						url = '/api/use/citiccard/jobconf/importSave';
						jobConf.opType = 'IMPORT'; //操作类型
					} else {
						jobConf.opType = 'CREATE'; //操作类型
					}
					_this.loading3 = true;
					jobConf.appCode = _this.searchFormdata.appCode;
					jobConf.confType = 'job'; //配置类型：作业流
					//1.1第一步参数
					jobConf.versionNo = _this.formdata1.versionNo;
					jobConf.versionRemark = _this.formdata1.versionRemark;
					//1.2第二步参数
					var jobExts = _this.getStep2Data(); //组装的第二部参数
					//校验第三步的数据
					var stflag = _this.vadistep3();
					if (stflag) {
						_this.loading3 = false;
						return;
					}
					//组装第三步数据
					var dependencyPos = _this.getData3();
					
					var jobExtsAll = _this.saveAllDate(jobExts,dependencyPos);
					//将第三步的数据组装到第二步中（按照作业分）					
					//2.发送请求
					jobConf.jobExts = jobExtsAll;
					yufp.service.request({
						method: 'POST',
						url: url,
						data: jobConf,
						callback: function(code, message, response) {
							_this.loading3 = false;
							if (response && response.code == 0) {
								//清空数据
								_this.clearAll();
								_this.dialogVisible = false;
								//刷新
								_this.$refs.refTable.remoteData();
							} else {
								_this.$message({
									message: response.message,
									type: 'warning'
								});
								return;
							}
						},
					});

				},
				saveAllDate:function(jobExts,dependencyPos){//按作业组装第三部的数据
					for(var i in jobExts){
						var jobData = [];
						for(var j in dependencyPos){
							if(jobExts[i].actionCode == dependencyPos[j].jobCode && jobExts[i].groupCode == dependencyPos[j].groupCode){
								 jobData.push(dependencyPos[j]);
							}
						}
						jobExts[i].dependencyPos = jobData;
					}
					return jobExts;
				},
				//清空指引数据
				clearAll: function() {
					this.formdata1.versionNo = '';;
					this.formdata1.versionRemark = '';
					this.data2 = [];
					this.data3 = [];
					this.active = 1;
				},
				//判断是否为引入，若是引入则通过作业流编码  系统编码  作业编码查询该作业的事件和参数
				getRelData: function(actionCode, groupCode) {
					var _this = this;
					var appCode = _this.searchFormdata.appCode;
					var josn = {
						'appCode': appCode,
						'groupCode': groupCode,
						'actionCode': actionCode
					};
					yufp.service.request({
						method: 'GET',
						async: false,
						url: '/api/use/plats/workflow/queryJobRelInfo',
						data: josn,
						callback: function(code, message, response) {
							if (response && response.code == 0) {
								var events = (response.data && response.data.events && response.data.events.length > 0) ? response.data
									.events : [];
								var params = (response.data && response.data.params && response.data.params.length > 0) ? response.data
									.params : [];
								_this.getData.wftParList = params;
								_this.getData.useEventCrossList = events;

							} else {
								_this.$message({
									message: response.message,
									type: 'warning'
								});
								return;
							}
						},
					});

				},
				moreall: function(cell) { //展示高级页面
					var _this = this;	
					setTimeout(function(){
									_this.workAdditionalFormData.radio1  = ''; 
									_this.workAdditionalFormData.radio2  = ''; 
									_this.workAdditionalFormData.radio3  = ''; 
									_this.workAdditionalFormData.date  = ''; 
									_this.workAdditionalFormData.date1  = ''; 
									_this.workAdditionalFormData.date2  = ''; 
									_this.workAdditionalFormData.day  = ''; 
									_this.workAdditionalFormData.datetype = '';
									_this.dutyTableParams.condition = JSON.stringify({
										appCode: '',
										eventType: 'G' 
									})
									_this.tabsValue = 'baseMsg';
									_this.dialogDetail = true;
										_this.$nextTick(function() {
											yufp.clone(cell.workBaseFormData, _this.workBaseFormData); //基本信息
											yufp.clone(cell.workExecFormData, _this.workExecFormData); //执行信息
										//	yufp.clone(cell.workAdditionalFormData, _this.workAdditionalFormData); //附加信息
				/* 							yufp.clone(cell.workAdditionalFormData.timeList, _this.timeList);
											yufp.clone(cell.workAdditionalFormData.timepicker, _this.timepicker); */
											_this.timeList = cell.workAdditionalFormData.timeList;
											if(cell.workAdditionalFormData.timepicker && cell.workAdditionalFormData.timepicker.length > 0){
												_this.timepicker = cell.workAdditionalFormData.timepicker;
											}else{
												_this.timepicker = '';
											}
											
											
											var oldParam = cell.workExecFormData.wftParList || [];
											var oldEvent = cell.workExecFormData.useEventCrossList || [];
											yufp.clone(cell.workExecFormData.useEventCrossList, _this.getData.useEventCrossList); //事件信息
											yufp.clone(cell.workExecFormData.wftParList, _this.getData.wftParList); //事件信息
											//处理参数信息
											var parm = [];
											var even = [];
											for(var item in oldParam){
												var j1 = {
															'paramName':oldParam[item].paramName,
															'paramValue':oldParam[item].paramValue,
															'remark':oldParam[item].remark,
														 };
														 parm.push(j1);
											}
											for(var item in oldEvent){
														 even.push(oldEvent[item]);
											}
											_this.getData.wftParList = parm;
											_this.getData.useEventCrossList = even;
										});	
					},300)
					
					

				},
				/**
				 * 加载节点数据
				 */
				loadData: function() {
					var _this = this;
					if (_this.getData.limitBegin !== "" && _this.getData.limitEnd !== " ") {
						_this.timepicker = [];
						_this.timepicker.push(new Date(2020, 5, 29, _this.getData.limitBegin.substring(0, 2), _this.getData.limitBegin
							.substring(2, 4), _this.getData.limitBegin.substring(4, 6)));
						_this.timepicker.push(new Date(2020, 5, 29, _this.getData.limitEnd.substring(0, 2), _this.getData.limitEnd.substring(
							2, 4), _this.getData.limitEnd.substring(4, 6)));
					}
					_this.$nextTick(function() {
						_this.$refs.refWorkBaseForm.resetFields();
						_this.$refs.refWorkExceForm.resetFields();
						_this.$refs.refWorkAdditionalForm.resetFields();
						_this.getData2Form(_this.getData);
						_this.workExecFormData.actionLoc = _this.getData.actionLoc;
						_this.workExecFormData.actionExec = _this.getData.actionExec;
					});
				},
				/**
				 * 加载集群代理名称
				 */
				queryWftAgtList: function(appCode) {
					var _this = this;
					var paramObj = {};
					paramObj.appCode = appCode;
					yufp.service.request({
						method: 'GET',
						url: backend.useService + "/plats/apps/queryWftAgtList",
						data: paramObj,
						async: false,
						callback: function(code, message, response) {
							if (response.code != 0) {
								isOk = false;
								_this.$message(response.message);
							} else {
								_this.agentIds.splice(0);
 								_this.agentIds.push({
									key: " ",
									value: "虚拟代理",
									show:"虚拟代理",
								});
								for (let i = 0; i < response.data.length; i++) {
									var show = response.data[i].agentCode+'('+response.data[i].agentName+')';
									_this.agentIds.push({
										key: response.data[i].agentCode,
										value: response.data[i].agentName,
										show:show
									});
								};
							}
						}
					});
				},
				/**
				 * 加载作业流列表
				 */
				getGroupCodeList: function(appCode) {
					var _this = this;
					var paramObj = {
						appCodeEq: appCode
					};
					var joblist = [];
					yufp.service.request({
						method: 'GET',
						url: "api/use/plats/workflow/queryWftGrpList",
						data: paramObj,
						async: false,
						callback: function(code, message, response) {
							if (response.code != 0) {
								_this.$message(response.message);
							} else {
								for (let i = 0; i < response.data.length; i++) {
									joblist.push({
										key: response.data[i].groupCode,
										value: response.data[i].groupName,
										
									});
								}
								_this.groupCodeList = joblist || [];
							}

						}
					});
				},
				/**
				 * 加载作业定义类型列表
				 */
				getJobList: function() {
					var _this = this;
					var joblist = [{'key':' ','value':'无','type':' '}];
					var paramObj = {};
					yufp.service.request({
						method: 'GET',
						url: "api/use/citiccard/jobtype/queryJobTypeListAll",
						data: paramObj,
						async: true,
						callback: function(code, message, response) {
							if (response.code != 0) {
								_this.$message(response.message);
							} else {
								for (let i = 0; i < response.data.length; i++) {
									joblist.push({
										key: response.data[i].jobTypeCode,
										value: response.data[i].jobTypeName,
										type: response.data[i].scriptReader,
										env: response.data[i].srcEnvParam || '',
										schema: response.data[i].srcSchameParam ||''
									});
								}
								_this.jobList = joblist || [];
							}
						}
					});
				},
				/**
				 * 依赖作业树
				 */
				focusFn: function() {
					var _this = this;
					_this.visible = true;
					_this.$nextTick(function() {
						var searchData = {};
						searchData.appCode = _this.workBaseFormData.appCode;
						searchData.groupCode = data.groupCode;
						// searchData.actionCode = _this.workBaseFormData.actionCode;
						var param = {
							condition: JSON.stringify(searchData)
						};
						_this.$refs.jobTableRef.remoteData(param);
					})
				},
				/**加载高级信息的方法 start*/
				/**
				 * 切换下一个tab视图
				 */
				nextToFn: function() {
					var _this = this;
					var validate = true;
					var tabs = ['baseMsg', 'exceMsg', 'moreMsg', 'eventMsg'];
					if (_this.tabsValue === 'baseMsg') {
						_this.$refs.refWorkBaseForm.validate(function(valid) {
							validate = valid;
						});
					} else if (_this.tabsValue === 'exceMsg') {
						_this.$refs.refWorkExceForm.validate(function(valid) {
							validate = valid;
						});
						if (validate) {
							// 校验表格数据
							this.$refs.refTableExec.validate(function(fields) {
								if (fields) {
									validate = false;
								}
							});
						}
					}
					if (!validate) {
						return;
					}
					if (_this.isExce && _this.tabsValue === 'baseMsg') {
						_this.tabsValue = tabs[tabs.indexOf(_this.tabsValue) + 2];
					} else {
						_this.tabsValue = tabs[tabs.indexOf(_this.tabsValue) + 1];
					}
				},
				/**
				 * 切换上一个tab视图
				 */
				lastFn: function() {
					var _this = this;
					var tabs = ['baseMsg', 'exceMsg', 'moreMsg', 'eventMsg'];
					if (_this.isExce && _this.tabsValue === 'moreMsg') {
						_this.tabsValue = tabs[tabs.indexOf(_this.tabsValue) - 2];
					} else {
						_this.tabsValue = tabs[tabs.indexOf(_this.tabsValue) - 1];
					}
				},
				/**
				 * 弹窗取消关闭按钮事件
				 */
				btnCancelFn: function() {
					var _this = this;
					this.dialogDetail = false;
				},
				/**
				 * 弹窗保存按钮事件，会根据当前节点类型执行不同的保存操作
				 */
				btnSaveFn: function() {
					this.saveWorkForm();
				},
				/* * 更新节点数据
				 */
				saveWorkForm: function() {
					var _this = this; //editDowIndex
					//校验输入的合法性
					var viflag = true;
					_this.$refs.refWorkBaseForm.validate(function (valid) {//基本信息
					  viflag = valid;
					});
					if(!viflag){
								  _this.$message({ message: '请完善基本信息必输内容!', type: 'warning' });
								  return;
					}
					_this.$refs.refWorkExceForm.validate(function (valid) { //执行信息
					  viflag = valid;
					});
					if(!viflag){
								  _this.$message({ message: '请完善执行信息必输内容!', type: 'warning' });
						  return;
					}
					_this.$refs.refWorkAdditionalForm.validate(function (valid) {//附加信息
					  viflag = valid;
					});
					if(!viflag){
								   _this.$message({ message: '请完善附加信息必输内容!', type: 'warning' });
						  return;
					}
					
					
					var editDowIndex = _this.editDowIndex;
					//_this.data2[editDowIndex].workBaseFormData = _this.workBaseFormData; //基本信息
					yufp.clone(_this.workBaseFormData, _this.data2[editDowIndex].workBaseFormData); //基本信息
					//_this.data2[editDowIndex].workExecFormData = _this.workExecFormData; //执行信息
					yufp.clone(_this.workExecFormData, _this.data2[editDowIndex].workExecFormData); //基本信息
				//	_this.data2[editDowIndex].workAdditionalFormData = _this.workAdditionalFormData; //附加信息
					yufp.clone(_this.workAdditionalFormData, _this.data2[editDowIndex].workAdditionalFormData); //基本信息
					/* yufp.clone(_this.getData.wftParList, _this.data2[editDowIndex].workExecFormData.wftParList); //基本信息
					yufp.clone(_this.getData.useEventCrossList, _this.data2[editDowIndex].workExecFormData.useEventCrossList); //基本信息 */
					_this.data2[editDowIndex].workExecFormData.wftParList = _this.getData.wftParList || [];
					_this.data2[editDowIndex].workExecFormData.useEventCrossList = _this.getData.useEventCrossList || [];
					
					_this.data2[editDowIndex].workAdditionalFormData.timeList = _this.timeList; //限制日历
					_this.data2[editDowIndex].workAdditionalFormData.timepicker = _this.timepicker; 
				//	yufp.clone(_this.timeList,_this.data2[editDowIndex].workAdditionalFormData.timeList ); 
				//	yufp.clone( _this.timepicker,_this.data2[editDowIndex].workAdditionalFormData.timepicker); 
					//_this.$set(_this.data2, editDowIndex, _this.data2[editDowIndex])
					
					this.$nextTick(function(){
						_this.dialogDetail = false;
					});
				},
				isThisActionCodeOnly: function(actionCode) { // 检验 actionCode 是否唯一
					var isOnly = true;
					this.workData.wftLstList.forEach(function(item) {
						if (item.actionCode == actionCode) {
							isOnly = false;
						}
					});
					return isOnly;
				},
				/**
				 * 切换执行位置修饰
				 */
				selectTypeCodeFn: function(val, Obj) {
					//return;
/* 					var _this = this;
					this.currentTips = this.actionTips[val] || '';
					this.workExecFormData.actionLoc = '';
					if (val === '+') {
						_this.isProcess = true;
					} else {
						_this.isProcess = false;
					}
					if (val === '-' || val === '+') {
						this.workBaseFormData.agentCode = ' ';
						this.workBaseFormData.multiFlag = 'N';
						this.workBaseFormData.intrFlag = 'Y';
						this.disabledOpr = true;
					} else {
						this.disabledOpr = false;
					}
					if (val === '-') {
						this.isHiddenAction = true;
						this.isHiddenActionSelect = true;
						this.isExce = true;
					} else if (val === '+' || val === 'D' || val === 'I' || val === 'J' || val === 'M' || val === 'R' || val ===
						'S' || val === 'T' || val === 'Q' || val === 'W') {
						this.isExce = false;
						this.isHiddenAction = true;
						this.isHiddenActionSelect = false;
						var urlObj = {
							'+': '/plats/apps/getTreeWftList',
							'D': '/plats/dscfg/queryList',
							'I': '/plats/pccfg/queryList',
							'J': '/plats/jccfg/queryList',
							'M': '/plats/rdbcfg/queryList',
							'R': '/plats/rdbcfg/queryList',
							'S': '/plats/rdbcfg/queryList',
							'Q': '/plats/rdbcfg/queryList',
							'T': '/plats/txdcfg/queryList',
							'W': '/plats/wscfg/queryList',
						}
						yufp.service.request({
							method: 'GET',
							url: backend.useService + urlObj[val],
							data: {
								appCode: data.appCode
							},
							async: false,
							callback: function(code, message, response) {
								if (response.code != 0) {
									_this.$message(response.message);
								} else {
									_this.actionLocOptions.splice(0);
									for (var i = 0; i < response.data.length; i++) {
										if (val === '+') {
											if (response.data[i].appCode != '0000') {
												_this.actionLocOptions.push({
													key: response.data[i].appCode,
													value: response.data[i].appName
												});
											}
										} else {
											_this.actionLocOptions.push({
												key: response.data[i].classCode,
												value: response.data[i].className
											});
										}
									}
									if (_this.actionLocOptions.length === 0) {
										_this.isHiddenAction = false;
										_this.isHiddenActionSelect = true;
									}
								}
							}
						});
					} else {
						this.isExce = false;
						this.isHiddenAction = false;
						this.isHiddenActionSelect = true;
					} */
				},
				/**
				 * 基本信息中执行信息新增
				 */
				btnAddClickFn: function() {
					var _this = this;
					var status = false;
					if (!_this.getData.wftParList) {
						_this.getData.wftParList = [];
					}
					if (_this.getData.wftParList.length > 0) {
						this.$refs.refTableExec.validate(function(fields) {
							if (!fields) {
								status = true;
							}
						});
						if (!status || _this.getData.wftParList[_this.getData.wftParList.length - 1].paramName === '') {
							this.$message({
								message: '请完善数据！',
								type: 'warning'
							});
							return;
						}
					}
					_this.getData.wftParList.push({
						appCode: _this.workBaseFormData.appCode,
						paramName: '',
						paramValue: '',
						remark: ''
					});
					_this.$forceUpdate();
				},
				/**
				 * 基本信息中执行信息删除
				 */
				btnDelClickFn: function() {
					var _this = this;
					var selections = _this.$refs.refTableExec.selections;
					if (selections.length === 0) {
						_this.$message({
							message: '请选择表格数据!',
							type: 'warning'
						});
						return;
					}
					for (var j = 0; j < selections.length; j++) {
						for (var i = 0; i < _this.getData.wftParList.length; i++) {
							if (_this.getData.wftParList[i].paramName == selections[j].paramName) {
								_this.getData.wftParList.splice(i, 1);
							}
						}
					}
				},
				/**
				 * 基本信息中事件信息删除
				 */
				btnDelEventsFn: function() {
					var _this = this;
					var selections = _this.$refs.refTableEvents.selections;
					if (selections.length === 0) {
						_this.$message({
							message: '请选择表格数据!',
							type: 'warning'
						});
						return;
					}
					for (var j = 0; j < selections.length; j++) {
						for (var i = 0; i < _this.getData.useEventCrossList.length; i++) {
							if (_this.getData.useEventCrossList[i].eventCode == selections[j].eventCode) {
								_this.getData.useEventCrossList.splice(i, 1);
							}
						}
					}
				},
				/**
				 * 基本信息中事件信息新增
				 */
				btnAddEventsFn: function() {
					var _this = this;
					_this.eventVisible = true;
					_this.dutytwoParams.condition = JSON.stringify({
							appCode: _this.searchFormdata.appCode,
							eventType:'G'
							//appCode: ''
						})
					_this.$nextTick(function() {
						_this.$refs.eventTableRef.remoteData(_this.dutytwoParams);
					})
				},
				getSelectedData: function(data) {
					var _this = this;
					//这里需要找到第几个在修改
					let clickIdex = _this.editDowIndexX || 0;
					_this.$refs.refTableExec.data[clickIdex].paramName = data[0].paramName;
				},
				checkVal:function(data){
					var _this = this;
					//这里需要找到第几个在修改
					let clickIdex = _this.editDowIndexX2 || 0;
					_this.paramDatas[clickIdex].paramCode = data[0].paramCode || '';
					_this.paramDatas[clickIdex].paramName = data[0].paramName || '';
				},
				rowClickFnX: function(row) {
					this.row = yufp.clone(row, {});
				},
				tableRowClassNameX({
					row,
					rowIndex
				}) {
					//吧每一行的索引放入row
					row.index = rowIndex;
				},
				tableRowClassNameX2({
					row,
					rowIndex
				}) {
					//吧每一行的索引放入row
					row.index = rowIndex;
				},
				rowClickFnOneX: function(row, column, cell, event) {
					this.editDowIndexX = row.index;

				},
				rowClickFnOneX2: function(row, column, cell, event) {
					this.editDowIndexX2 = row.index;
					this.nodeTemp.paramSelectValue = row.paramValue;				
				},
				relationChangeFn: function(val) {
					var _this = this;
					if (val === 'T' && _this.row.eventType === 'F') {
						for (var i = 0; i < _this.getData.useEventCrossList.length; i++) {
							if (_this.row.eventName === _this.getData.useEventCrossList[i].eventName) {
								this.getData.useEventCrossList[i].relation = 'D';
								//_this.$set(_this.getData.useEventCrossList[i],'relation','D')
								_this.$set(_this.getData.useEventCrossList, i, _this.getData.useEventCrossList[i]) //使vue识别该数组变化
								_this.$message({
									message: '文件事件类型不能触发！',
									type: 'warning'
								});

								return;
							}
						}
					}

				},
				/**
				 * 开始时间限制
				 */
				limitBeginFn: function() {
					var _this = this;
					var message;
					_this.$refs.refWorkAdditionalForm.validateField('limitBegin', function(msg) {
						message = msg;
					});
					if (message) {
						return;
					}

					var limitEnd = _this.workAdditionalFormData.limitEnd.trim() !== '' && _this.workAdditionalFormData.limitEnd !==
						null && _this.workAdditionalFormData.limitEnd !== undefined;
					var limitBegin = _this.workAdditionalFormData.limitBegin.trim() !== '' && _this.workAdditionalFormData.limitBegin !==
						null && _this.workAdditionalFormData.limitBegin !== undefined;
					if (limitEnd && limitBegin) {
						if (+_this.workAdditionalFormData.limitBegin > +_this.workAdditionalFormData.limitEnd) {
							_this.$message({
								message: '开始时间不能大于结束时间!',
								type: 'warning'
							});
							_this.workAdditionalFormData.limitBegin = '';
						}
					}
				},
				/**
				 * 结束时间限制
				 */
				limitEndFn: function() {
					var _this = this;
					var message;
					_this.$refs.refWorkAdditionalForm.validateField('limitEnd', function(msg) {
						message = msg;
					});
					if (message) {
						return;
					}
					var limitEnd = _this.workAdditionalFormData.limitEnd.trim() !== '' && _this.workAdditionalFormData.limitEnd !==
						null && _this.workAdditionalFormData.limitEnd !== undefined;
					var limitBegin = _this.workAdditionalFormData.limitBegin.trim() !== '' && _this.workAdditionalFormData.limitBegin !==
						null && _this.workAdditionalFormData.limitBegin !== undefined;
					if (limitEnd && limitBegin) {
						if (+_this.workAdditionalFormData.limitBegin > +_this.workAdditionalFormData.limitEnd) {
							_this.$message({
								message: '结束时间不能小于开始时间!',
								type: 'warning'
							});
							_this.workAdditionalFormData.limitEnd = '';
						}
					}
				},
				/* 时间选择事件
				 */
				timeSelectFn: function (val) {
				  this.selectTime = val;
				},
				/**
				/**
				 * 添加时间
				 */
				addFn: function() {
					if (this.workAdditionalFormData.radio1) {
						if (!this.workAdditionalFormData.date) {
							this.$message({
								message: '请输入日期',
								type: 'warning'
							});
							return;
						}
						var value = (this.workAdditionalFormData.date.getMonth() + 1 > 9 ? this.workAdditionalFormData.date.getMonth() +
							1 : '0' + (this.workAdditionalFormData.date.getMonth() + 1)) + '月' + (this.workAdditionalFormData.date.getDate() <
							10 ? '0' + this.workAdditionalFormData.date.getDate() : this.workAdditionalFormData.date.getDate()) + '日';
						var key = '' + (this.workAdditionalFormData.date.getMonth() + 1 > 9 ? this.workAdditionalFormData.date.getMonth() +
							1 : '0' + (this.workAdditionalFormData.date.getMonth() + 1)) + (this.workAdditionalFormData.date.getDate() <
							10 ? '0' + this.workAdditionalFormData.date.getDate() : this.workAdditionalFormData.date.getDate());
						for (var i in this.timeList) {
							if (this.timeList[i].key == key) {
								this.$message({
									message: '请添加不同日期',
									type: 'warning'
								});
								this.workAdditionalFormData.date = '';
								return;
							}
						}
						this.timeList.push({
							key: key,
							value: value
						});
						this.workAdditionalFormData.date = '';
					} else if (this.workAdditionalFormData.radio2) {
						var flag = this.workAdditionalFormData.day && this.workAdditionalFormData.date1 && this.workAdditionalFormData
							.date2;
						if (!flag) {
							this.$message({
								message: '请输入完整日期',
								type: 'warning'
							});
							return;
						}
						if (isNaN(this.workAdditionalFormData.day)) { //校验天为数字
							return;
						}
						//增加数字限制检验规则



						this.$refs.refWorkAdditionalForm.validateField('day', dayError => {
							if (dayError) {
								this.$refs.dayref.fields.error = 'error'
								return;
							}

						});

						var key = this.workAdditionalFormData.date1 + this.workAdditionalFormData.date2 + (this.workAdditionalFormData
							.day < 10 ? '0' + this.workAdditionalFormData.day : this.workAdditionalFormData.day);
						var value = yufp.lookup.convertKey('USE_FIXED_TIME_RANGE', this.workAdditionalFormData.date1) + yufp.lookup
							.convertKey('USE_FIXED_TIME_F', this.workAdditionalFormData.date2) + (this.workAdditionalFormData.day < 10 ?
								'0' + this.workAdditionalFormData.day : this.workAdditionalFormData.day) + '天';
						for (var i in this.timeList) {
							if (this.timeList[i].key == key) {
								this.$message({
									message: '请添加不同日期',
									type: 'warning'
								});
								this.workAdditionalFormData.day = '';
								return;
							}
						}
						this.timeList.push({
							key: key,
							value: value
						});
						this.workAdditionalFormData.day = '';
					} else if (this.workAdditionalFormData.radio3) {
						var value = '';
						if (!this.workAdditionalFormData.datetype) {
							this.$message({
								message: '请输入完整日期类型',
								type: 'warning'
							});
							return;
						}
						for (var i in this.dateTypeOptions) {
							if (this.dateTypeOptions[i].key == this.workAdditionalFormData.datetype) {
								value = this.dateTypeOptions[i].value;
								break;
							}
						}
						for (var j in this.timeList) {
							if (this.timeList[j].key.slice(0, 3) === '@DT' && this.timeList[j].key.slice(3) == this.workAdditionalFormData
								.datetype) {
								this.$message({
									message: '请添加不同日期类型',
									type: 'warning'
								});
								this.workAdditionalFormData.datetype = '';
								return;
							}
						}
						this.timeList.push({
							key: "@DT" + this.dateTypeOptions[i].key,
							value: this.dateTypeOptions[i].value
						});
						this.workAdditionalFormData.datetype = '';
					}
				},
				/**
				 * 删除事件
				 */
				deleteFnTime:function(){
					if (!this.selectTime) {
					  this.$message({ message: '请选择日期', type: 'warning' });
					}
					this.timeList.splice(this.timeList.indexOf(this.selectTime), 1);
					this.selectTime = {};	
				},
				/**
				 * 删除
				 */
				deleteFn: function() {
					var _this = this;
					var selections = _this.$refs.refTable.selections;
					if (selections.length != 1) {
						_this.$message({
							message: '请先选择一条记录',
							type: 'warning'
						});
						return;
					}
					var versionNo = selections[0].versionNo;
					var opType =  selections[0].opType;
					_this.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning',
						center: true,
						callback: function(action) {
							if (action === 'confirm') {
								yufp.service.request({
									method: 'DELETE',
									url: 'api/use/citiccard/jobconf/delete',
									data: {
										'versionNo': versionNo,
										'opType':opType
									},
									callback: function(code, message, response) {
										if (response.code == 0) {
											_this.$refs.refTable.remoteData();
											_this.$message('操作成功');
										} else {
											_this.$message(response.message);
										}
									}
								});
							}
						}
					});
				},

				/**加载高级信息的方法 end*/

				viewDataFn: function(data) {
					const _this = this;
					_this.dialogVisible = true;
					const param = {};
					param.cycleTime = data.cycleTime;
					param.appCode = data.appCode;
					param.eventCode = data.eventCode;
					_this.$nextTick(function() {
						yufp.service.request({
							method: 'GET',
							url: "api/use/monitor/eventLog/queryFileList",
							data: param,
							async: false,
							callback: function(code, message, response) {
								if (response.code != 0) {
									_this.$message(response.message);
								} else {
									_this.eventFiles.splice(0);

									for (let i = 0; i < response.data.length; i++) {
										_this.eventFiles.push(response.data[i]);
									}
								}

							}
						});
					});

				},

				recordEvent: function() {
					var _this = this;
					if (_this.$refs.refTable.selections.length !== 1) {
						_this.$message({
							message: '请先选择一条记录',
							type: 'warning'
						});
						return;
					}
					var data = _this.$refs.refTable.selections[0];
					let urlparam = 'api/use/UseEventLog/updateEventLog';

					yufp.service.request({
						method: 'POST',
						url: urlparam,
						data: {
							appCode: data.appName,
							eventCode: data.eventCode,
							cycleTime: data.cycleTime
						},
						callback: function(code, message, response) {

							if (response.code === 0) {
								_this.$message('操作成功');
								_this.$refs.refTable.remoteData("");
							} else {
								_this.$message(response.message);
							}
						}
					});
				},
				deleteEvent: function() {
					var _this = this;
					if (_this.$refs.refTable.selections.length !== 1) {
						_this.$message({
							message: '请先选择一条记录',
							type: 'warning'
						});
						return;
					}
					var data = _this.$refs.refTable.selections[0];
					let urlparam = 'api/use/UseEventLog/updateEventLogNull';

					yufp.service.request({
						method: 'POST',
						url: urlparam,
						data: {
							appCode: data.appName,
							eventCode: data.eventCode,
							cycleTime: data.cycleTime
						},
						callback: function(code, message, response) {

							if (response.code === 0) {
								_this.$message('操作成功');
								_this.$refs.refTable.remoteData("");
							} else {
								_this.$message(response.message);
							}
						}
					});
				},
				/**
				 * 点击树的结点，加载对应的数据
				 */
				/**
				 * 点击树的结点，加载对应的数据
				 */
				nodeClickFn: function(nodeData, node, self) {

					var _this = this;
					_this.currentClickNode = nodeData;
					var appCode = "";
					let folderCode = "";
					if (nodeData.nodeType === 'R') {
						_this.isAppNode = false;
						_this.appNameDisabled = false
						_this.searchFormdata.appName = '';
						appCode = "";

					} else if (nodeData.nodeType === 'A') {
						_this.isAppNode = true;
						_this.currAppNode = nodeData;
						_this.appNameDisabled = true;
						_this.searchFormdata.appName = nodeData.appName;
						appCode = nodeData.currentNodeId;
					} else {
						_this.isAppNode = true;
						_this.currAppNode = nodeData;
						_this.appNameDisabled = true;
						_this.searchFormdata.appName = nodeData.appName;
						appCode = nodeData.appCode;
						folderCode = nodeData.currentNodeId;
					}
					var paramObj = {};
					_this.searchFormdata.appCode = appCode;
					_this.searchFormdata.folderCode = folderCode;
					_this.paramObj.appCode = appCode;

					if (appCode) {
						_this.initBaseParams(appCode);
						//获取集群代理名称列表
						_this.queryWftAgtList(appCode);
						//根据系统名称获取作业流列表
						_this.getGroupCodeList(appCode);
					}

					var param = {
						condition: JSON.stringify(_this.searchFormdata)
					};
					_this.$refs.refTable.remoteData(param);

				},
				//初始化各个节点的公共参数
				initBaseParams:function(code){
					var _this = this;
					 if(code){
						 _this.paramObj.appCode = code;
						 _this.dutyTableParams.condition = JSON.stringify({
						 	appCode: code,
						 	eventType: 'G'
						 })
						 _this.baseGroupParams.condition = JSON.stringify({
						 	appCode: code
						 })
						 _this.dutytwoParams.condition = JSON.stringify({
						 	appCode: code
						 })
						 _this.triggerParams.condition = JSON.stringify({
						 	appCode: code
						 })
					 }else{
						 if(_this.searchFormdata.appCode){
							 _this.initBaseParams(this.searchFormdata.appCode);
						 }
						 
					 }					
				}
			},
		});
	};
});
